• Resolved dimal

    (@dimalifragis)


    Hi,

    We use wpForo plugin (forum). wpForo doesn’t use custom posts but has its own tables (actually its own everything, caching, seo etc etc).

    I see that your plugin IS active on each and every visitor of forum topics and posts. And as you know forums have a large ammount of posts.

    So i would like to ask how to exclude the whole forum from that unneeded LOAD.

    The forum “sits” in a page with a shortcode.

    Any ideas?

    Thank you

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

    (@hcabrera)

    Hi @dimalifragis,

    No idea to be honest. While I have heard of it I’m not really familiar with wpForo nor have used it yet. I’ll need to install it and see how it works before I can give you a more definitive answer.

    Thread Starter dimal

    (@dimalifragis)

    Ok, maybe some simple way exists? Since that plugin uses a Page and a shortcode, how can i exclude a specific page? I guess then, the whole forum will be excluded.

    Thanks

    Plugin Author Hector Cabrera

    (@hcabrera)

    Ok, maybe some simple way exists? Since that plugin uses a Page and a shortcode, how can i exclude a specific page? I guess then, the whole forum will be excluded.

    I don’t think it’s that simple.

    I took a quick look and it seems that wpForo doesn’t provide any sort of developer documentation (at least it’s not linked on their plugin page nor could find it on their website). Right now your best bet would be to reach out to the wpForo team to ask them if there’s a way to determine via either a WordPress theme and/or a third-party plugin if the current page is a wpForo page (the forum homepage, a topic page, etc) so you can perform certain actions when that’s the case (eg. exclude a JS file from loading). Hopefully they’ll give you some pointers and we can take it from there.

    Thread Starter dimal

    (@dimalifragis)

    Something like that?

    // Make sure this is not a wpForo forum page
    if( function_exists('is_wpforo_page') ){
        if( ! is_wpforo_page() ){
            //This is NOT a wpForo page ...
        }
    }
    Plugin Author Hector Cabrera

    (@hcabrera)

    Yep, that did the trick!

    Please add this code snippet to your theme’s functions.php file and WPP will not track visits to forum topics:

    /**
     * Have WPP ignore wpForo page views.
     *
     * @param  array $post_types
     * @return array $post_types
     */
    function wpp_exclude_wpforo_views($post_types) {
        if( function_exists('is_wpforo_page') && is_wpforo_page() ) {
            $post_types = array('invalid-post-type');
        }
    
        return $post_types;
    }
    add_filter( 'wpp_trackable_post_types', 'wpp_exclude_wpforo_views', 10, 1 );
    Thread Starter dimal

    (@dimalifragis)

    Thank you. I will do that and update here the results.

    Thread Starter dimal

    (@dimalifragis)

    Works fine, thank you!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Exclude a forum from counting/logging’ is closed to new replies.