Title: Log views from&#8230;
Last modified: December 6, 2023

---

# Log views from…

 *  Resolved [Ole](https://wordpress.org/support/users/olpo24/)
 * (@olpo24)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/log-views-from/)
 * Hi,
   first of all thank you for this amazing plugin.In the settigs there is a 
   oiption to set “_Log views from_” everyone, or logged in or logged out visitors.
   I need a setting “exclude Admin and current post author”.Is there a way to achieve
   this? Maybe a filter? (I didn’t find anything on the github wiki)Kind regards,
 * Ole

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/log-views-from/#post-17256993)
 * Hi [@olpo24](https://wordpress.org/support/users/olpo24/),
 * For this you could use the [wpp_trackable_post_types](https://github.com/cabrerahector/wordpress-popular-posts/wiki/3.-Filters#wpp_trackable_post_types)
   filter hook to have WordPress Popular Posts track views only if the visitor is
   not logged in / not an admin / not the author of the current post/page. For example:
 *     ```wp-block-code
       /**
        * Don't track page views if user is an administrator
        * or if user is the author of the entry.
        *
        * @param  array $post_types
        * @return array
        */
       function maybe_do_not_track_views($post_types) {
       	if ( is_user_logged_in() ) {
       		$post_id = get_queried_object_id();
       		$current_user = wp_get_current_user();
       		$author_id = get_post_field('post_author', $post_id);
       		$current_user_is_admin = current_user_can('manage_options');
   
       		if ( $current_user_is_admin || $current_user->ID == $author_id ) {
       			return array('do_not_track');
       		}
       	}
   
       	return $post_types;
       }
       add_filter('wpp_trackable_post_types', 'maybe_do_not_track_views', 10, 1);
       ```
   
 *  Thread Starter [Ole](https://wordpress.org/support/users/olpo24/)
 * (@olpo24)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/log-views-from/#post-17258173)
 * Hi [@hcabrera](https://wordpress.org/support/users/hcabrera/)
 * Thank you very much!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Log views from…’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-popular-posts/assets/icon-256x256.png?rev=1232659)
 * [WP Popular Posts](https://wordpress.org/plugins/wordpress-popular-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-popular-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-popular-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-popular-posts/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Ole](https://wordpress.org/support/users/olpo24/)
 * Last activity: [2 years, 6 months ago](https://wordpress.org/support/topic/log-views-from/#post-17258173)
 * Status: resolved