[Solved] Disable wp-embed unless on forum pages  

  RSS

Sho-Down
New Member Customer
Joined:6 months  ago
Posts: 4
15/04/2017 5:40 am  

I noticed the default wp-embed loads on every page by default, I'd like to only load it on single.php and the forum pages (so wpForo Embeds works correctly). I have this in my functions.php file but it's not working:

//Disable WP-Embed Unless Single or Forums

if ( !is_single() && !is_page('community') ) {

function deregister_wpembed_script(){

wp_deregister_script('wp-embed');}

add_action( 'wp_footer', 'deregister_wpembed_script');

}

ReplyQuote
Sho-Down
New Member Customer
Joined:6 months  ago
Posts: 4
15/04/2017 5:42 am  

I guess my question is what code would I put to enable loading wp-embed javascript on all forum pages? is_page('community') doesn't work for all forum pages.


ReplyQuote
Sho-Down
New Member Customer
Joined:6 months  ago
Posts: 4
15/04/2017 6:01 am  

For example bbpress has if( is_bbpress(), does wpforo have something like that?


ReplyQuote
Tom
 Tom
Support Team Admin
Joined:2 years  ago
Posts: 2006
15/04/2017 3:18 pm  

Hi Sho-Down,

try this:

if ( is_wpforo_page() ){
....
}

wpDiscuz Documentation


ReplyQuote
Sho-Down
New Member Customer
Joined:6 months  ago
Posts: 4
15/04/2017 6:59 pm  

Thanks, that worked!


ReplyQuote
  
Working

Please Login or Register