Notifications
Clear all

[Solved] Disable wp-embed unless on forum pages

5 Posts
2 Users
0 Reactions
2,422 Views
Posts: 4
Customer
Topic starter
(@sho-down)
Member
Joined: 8 years ago

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');

}
4 Replies
Posts: 4
Customer
Topic starter
(@sho-down)
Member
Joined: 8 years ago

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.

Reply
Posts: 4
Customer
Topic starter
(@sho-down)
Member
Joined: 8 years ago

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

Reply
Posts: 4213
 Tom
Admin
(@tomson)
Famed Member
Joined: 10 years ago

Hi Sho-Down,

try this:

if ( is_wpforo_page() ){
....
}
Reply
Posts: 4
Customer
Topic starter
(@sho-down)
Member
Joined: 8 years ago

Thanks, that worked!

Reply
Share:
Scroll to top