Support » Plugin: WP-PostViews » Thanks for the filter ‘postviews_should_count’!

  • malferov

    (@malferov)


    Now I can independently control the logic of counting! Like this:

    function exclude_wp_post_views_count($should_count, $id) {
        if ( current_user_can('administrator') ) { // or other condition(s)
            $should_count = false;
        }
        return $should_count;
    }
    add_filter('postviews_should_count', 'exclude_wp_post_views_count', 10, 2);
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Thanks for the filter ‘postviews_should_count’!’ is closed to new replies.