WordPress/BuddyPress – Meta title tag not working

If your buddypress child theme or customized parent theme does not work properly, in otherwords does you title tag output “[Blogname] – Blog” then use the code below to remedy the error.

Whats happening is if you use bp_title_tag() is will output the default string as seen above. If you lean towards using the WordPress conditional tags to test the pages, WordPress will see the BuddyPress pages as normal static pages.

Using bp_get_title_tag we can test to see if its a WordPress page or a BuddyPress page and use the appropriate title tag.

if ( is_home() ) { bloginfo('name'); echo '&nbsp;|&nbsp;'; bloginfo('description'); }
elseif ( is_search() ) { bloginfo('name'); echo '&nbsp;|&nbsp;'; _e('Search Results'); }
elseif ( is_author() ) { bloginfo('name'); echo '&nbsp;|&nbsp;'; _e('Author Archives'); }
elseif ( is_single() ) { bloginfo('name'); echo '&nbsp;|&nbsp;'; wp_title(''); }

// Entering the buddypress tags
elseif ( is_page() ) {

 $page_title = rtrim(ltrim(bp_get_page_title()));

 if ( $page_title == "[INSETRT YOUR WP_TITLE HERE] — Blog" ) { bloginfo('name'); echo '&nbsp;|&nbsp;'; wp_title('');}
 else{ bp_page_title(); }
elseif ( is_category() ) { bloginfo('name'); echo '&nbsp;|&nbsp;'; _e('Archive'); echo '&nbsp;|&nbsp;'; single_cat_title(); }
elseif ( is_month() ) {  bloginfo('name'); echo '&nbsp;|&nbsp;'; _e('Archive'); echo '&nbsp;|&nbsp;'; the_time('F'); }
elseif (function_exists('is_tag')) { if ( is_tag() ) { bloginfo('name'); echo '&nbsp;|&nbsp;'; _e('Tag Archive'); echo '&nbsp;|&nbsp;';  single_tag_title("", true); } }
else {  } ?></title>

3 responses to “WordPress/BuddyPress – Meta title tag not working”

  1. AntonRSA Avatar


    I modified it a bit but it works 100%. Now to just configure a third party SEO plugin that works with bp 1.2. I’ve tried All in one seo pack but it doesn’t work that smoothly. On the activity stream (my home page) it adds the title as “| Your site Name” and nothing else.

    Thanks once again.

  2. John Avatar

    I used this code in my header.php and now I can’t access my bbPress directory for some reason which is located at sitename/forums

    Any reason why? Also, I undid it and it’s still not letting me access the directory but rather redirecting me to the home page.

  3. admin Avatar

    Hey John

    Did you also use the code from this post?
    * http://www.thesaucymare.co.za/2010/05/integrate-a-blank-buddybar-into-bbpress/

    Integrating bbpress with wp this way, causes me to redirect to the home everytime i tried to access bb-admin. I have updated it to call wp-load.php. This solved me problem and i was able to access the admin area.

Leave a Reply

Your email address will not be published. Required fields are marked *