• Resolved zenial

    (@zenial)


    Wonder if it possible somehow to stop counting page views and let the plugin count only views for published posts?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hey there,

    Not sure if I understand your question but WPP tracks views for published content only (posts, pages, etc). Drafts and other non “publish” statuses are not taken into account.

    Care to explain in more details what you’re trying to achieve?

    Thread Starter zenial

    (@zenial)

    I understand how it works. But I don’t need to count views for pages. Is it possible to choose counting only for posts?

    My project consists of 10 static pages and every week I’m updating (only) the content of them (already for few years). So, in my case, I do not need page counting to avoid unnecessary litter in the DB.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Ah yes, actually there’s a filter hook for that: wpp_trackable_post_types.

    Thread Starter zenial

    (@zenial)

    Ohh. Everything is already existing ??

    Just to clarify. In my case, to count views only for published posts, I should place such code:

    function my_trackable_post_types( $post_types ){	
    	$track_these_post_types_only = array( 'post' );	
    	return $track_these_post_types_only;
    }
    add_filter( 'wpp_trackable_post_types', 'my_trackable_post_types', 10, 1 );

    Your help would be much appreciated.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Correct! Place that code snippet inside your theme’s functions.php file (or in a mu-plugin) and you’re good to go.

    Thread Starter zenial

    (@zenial)

    Ok, got it! Incredibly responsive support here! Thanks a lot and best wishes! ??

    Plugin Author Hector Cabrera

    (@hcabrera)

    Don’t mention it ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Stop counting page views’ is closed to new replies.