Ready to get started?Download WordPress


[resolved] [Plugin: Recently Viewed Posts] How can I remove the visists counter of bots? (3 posts)

  1. camus
    Posted 4 years ago #

    Hi. How do I get visits from the bots not contain my "recently viewed posts"?

    Every time my posts are being visiteds, but by bots..

    Since the plugin dont count admin's visists, I think that this is possible..


  2. Pinoy.ca
    Posted 4 years ago #

    Hi, thanks for checking out my plugin!

    Create a handler for the recently_viewed_posts_new filter in your theme's functions.php that will return NULL on the bots' visits. For example,

    add_filter("recently_viewed_posts_new", "my_rvp_ignore_bot_visits");
    function my_rvp_ignore_bot_visits( $item ) {
        $bots = 'Google|msnbot|Rambler|Yahoo|AbachoBOT|accoona|' .
            'AcioRobot|ASPSeek|CocoCrawler|Dumbot|FAST-WebCrawler|' .
            'GeonaBot|Gigabot|Lycos|MSRBOT|Scooter|AltaVista|IDBot|' .
        return (preg_match("/$bots/", $_SERVER['HTTP_USER_AGENT']) > 0) ? null : $item;

    The code is from Jay Paroline http://wanderr.com/jay/detect-crawlers-with-php-faster/2009/04/08/ . I hope this helps.

  3. camus
    Posted 4 years ago #

    This really helped me.


Topic Closed

This topic has been closed to new replies.

About this Topic