Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I added bbpress forum pluggin in my site to handle discussions, forum or comments. The bbPress CSS file is added to every page of my blog. Now, I want to load it only on forum directory to consider page speed. Is there any way to do this?

share|improve this question
If it means anything to you, your site loads fine, and I could be wrong but the bbpress css is only executed on bbpress pages –  Aliyah Feb 15 '13 at 21:25
Every single millisecond counts. Thanks though. –  Angelo Suerte Feb 15 '13 at 21:27
You're welcome. –  Aliyah Feb 15 '13 at 21:29

2 Answers 2

up vote 1 down vote accepted

The styles are enqueued in the function enqueue_styles() inside the file /wp-content/plugins/bbpress/templates/default/bbpress-functions.php.

It's a matter of using is_bbpress() and wp_dequeue_style. Only one of the styles is enqueued, but here we're removing all 3 possibilities.

add_action( 'wp_enqueue_scripts', 'bbpress_enqueue_wpse_87081', 15 );

function bbpress_enqueue_wpse_87081()
    // Check if bbpress exists
    if( !function_exists( 'is_bbpress' ) )

    if( !is_bbpress() )
share|improve this answer
Thanks! This is the one I'm looking for. –  Angelo Suerte Feb 16 '13 at 0:26

try this in your header

if(is_page_template('bbpress.php' 'forum.php' or whatever your forum template is)){
   echo '<link href="path/to/stylesheet.css" rel="stylesheet" type="text/css" />';

the if(is_page_template) is supposed to load the css only on that page template.


       echo '<link href="path/to/stylesheet.css" rel="stylesheet" type="text/css" />';
share|improve this answer
There is no bbpress template in my theme. It resides on plugin directory. Please check it out on –  Angelo Suerte Feb 15 '13 at 20:58
What is your bbpress slug? /forum? /support? –  Aliyah Feb 15 '13 at 20:59
The slug is /forums/ –  Angelo Suerte Feb 15 '13 at 21:01
Yeah, I think it will work, perhaps. However, using that if statement I might have duplicated the css without unhooking the other one... –  Angelo Suerte Feb 15 '13 at 21:07
Find the file where the css is originally loaded, comment the lines out and duplicate the above to include all bbpress css links. –  Aliyah Feb 15 '13 at 21:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.