WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. camus
    Member
    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..

    http://wordpress.org/extend/plugins/recently-viewed-posts/

  2. Pinoy.ca
    Member
    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|' .
            'eStyle|Scrubby';
        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
    Member
    Posted 4 years ago #

    This really helped me.

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic