Skip to:
Content
Pages
Categories
Search
Top
Bottom

Behavior problem with Title Tags

  • I ran a search and didn’t find an answer to this. If there is one please point me to the right post.

    Behavior problem with Title Tags

    Site is multi-site 3.6, buddy press 1.81, bbpress 2.4. All other themes and plugis current. Problem on the main site only. Sub-domains not effected.

    I found the title tags aren’t showing up correctly. On all pages other then BP pages and home page only the site name shows up as title in the browser. I can see that the page name/site Page | site name is trying to show but loops back to just the site name without the page or pipe.

    I change the theme to 2012 and I still had the same problem.

    I’ve tested in Chrome, Firefox and IE all behave the same.

    I cleared, cache, temp internet history and file throughout the process of finding what’s wrong.

    I deactivated all plugins and Title tags returned to normal tag behavior. I activated the plugins 1 by one and discovered that BBPress is causing the problem with the title tags. I deactivate all plugins again and activated only bbpress and sure enough it’s the problem. Right now I have BBPress deactivated.

    Please help me through this issue.

Viewing 6 replies - 1 through 6 (of 6 total)
  • I found Version 2.3.2 on my computer. deleted 2.4 uploaded 2.3.2 and Title tags work as they should.

    Definitely a problem with 2.4 messing with Title tags.

    If there is a fix let me know and I’ll be happy to test it.

    Thanks


    Zack Tollman
    Participant

    @tollmanz

    Hi there!

    I just updated to bbPress 2.4 and experienced the same problem. All titles not on bbPress pages were rendered as blank titles.

    It seems bbPress 2.4 introduced a new function that filters the wp_title function. As a temporary workaround that does not required bbPress plugin file changes, I have added the following to my theme’s functions.php:

    /**
     * Restore non bbPress page titles.
     *
     * v2.4 of bbPress introduced a bug where titles for all non-bbPress pages were blank. This function restores order
     * without overwriting the bbPress core files. It uses the exact same function as bbPress for the titles with one
     * change: if none of the bbPress queries match, it returns the original title.
     *
     * The function first removes the bbPress filter that performs this action, then uses it's own routine to determine the
     * title.
     *
     * @param  string    $title          Optional. The title (not used).
     * @param  string    $sep            Optional, default is '»'. How to separate the various items within the page title.
     * @param  string    $seplocation    Optional. Direction to display title, 'right'.
     * @return string                    Modified title.
     */
    function my_prefix_bbp_title( $title, $sep, $seplocation ) {
    	// Get rid of the core "bbp_title" filter callback
    	remove_filter( 'wp_title', 'bbp_title', 10, 3 );
    
    	// Store original title to compare
    	$_title = $title;
    
    	// Title array
    	$title = array();
    
    	/** Archives **************************************************************/
    
    	// Forum Archive
    	if ( bbp_is_forum_archive() ) {
    		$title['text'] = bbp_get_forum_archive_title();
    
    	// Topic Archive
    	} elseif ( bbp_is_topic_archive() ) {
    		$title['text'] = bbp_get_topic_archive_title();
    
    	/** Edit ******************************************************************/
    
    	// Forum edit page
    	} elseif ( bbp_is_forum_edit() ) {
    		$title['text']   = bbp_get_forum_title();
    		$title['format'] = esc_attr__( 'Forum Edit: %s', 'bbpress' );
    
    	// Topic edit page
    	} elseif ( bbp_is_topic_edit() ) {
    		$title['text']   = bbp_get_topic_title();
    		$title['format'] = esc_attr__( 'Topic Edit: %s', 'bbpress' );
    
    	// Reply edit page
    	} elseif ( bbp_is_reply_edit() ) {
    		$title['text']   = bbp_get_reply_title();
    		$title['format'] = esc_attr__( 'Reply Edit: %s', 'bbpress' );
    
    	// Topic tag edit page
    	} elseif ( bbp_is_topic_tag_edit() ) {
    		$title['text']   = bbp_get_topic_tag_name();
    		$title['format'] = esc_attr__( 'Topic Tag Edit: %s', 'bbpress' );
    
    	/** Singles ***************************************************************/
    
    	// Forum page
    	} elseif ( bbp_is_single_forum() ) {
    		$title['text']   = bbp_get_forum_title();
    		$title['format'] = esc_attr__( 'Forum: %s', 'bbpress' );
    
    	// Topic page
    	} elseif ( bbp_is_single_topic() ) {
    		$title['text']   = bbp_get_topic_title();
    		$title['format'] = esc_attr__( 'Topic: %s', 'bbpress' );
    
    	// Replies
    	} elseif ( bbp_is_single_reply() ) {
    		$title['text']   = bbp_get_reply_title();
    
    	// Topic tag page
    	} elseif ( bbp_is_topic_tag() || get_query_var( 'bbp_topic_tag' ) ) {
    		$title['text']   = bbp_get_topic_tag_name();
    		$title['format'] = esc_attr__( 'Topic Tag: %s', 'bbpress' );
    
    	/** Users *****************************************************************/
    
    	// Profile page
    	} elseif ( bbp_is_single_user() ) {
    
    		// Current users profile
    		if ( bbp_is_user_home() ) {
    			$title['text'] = esc_attr__( 'Your Profile', 'bbpress' );
    
    		// Other users profile
    		} else {
    			$title['text']   = get_userdata( bbp_get_user_id() )->display_name;
    			$title['format'] = esc_attr__( "%s's Profile", 'bbpress' );
    		}
    
    	// Profile edit page
    	} elseif ( bbp_is_single_user_edit() ) {
    
    		// Current users profile
    		if ( bbp_is_user_home_edit() ) {
    			$title['text']   = esc_attr__( 'Edit Your Profile', 'bbpress' );
    
    		// Other users profile
    		} else {
    			$title['text']   = get_userdata( bbp_get_user_id() )->display_name;
    			$title['format'] = esc_attr__( "Edit %s's Profile", 'bbpress' );
    		}
    
    	/** Views *****************************************************************/
    
    	// Views
    	} elseif ( bbp_is_single_view() ) {
    		$title['text']   = bbp_get_view_title();
    		$title['format'] = esc_attr__( 'View: %s', 'bbpress' );
    
    	/** Search ****************************************************************/
    
    	// Search
    	} elseif ( bbp_is_search() ) {
    		$title['text'] = bbp_get_search_title();
    	} else {
    		return $_title;
    	}
    
    	// This filter is deprecated. Use 'bbp_before_title_parse_args' instead.
    	$title = apply_filters( 'bbp_raw_title_array', $title );
    
    	// Set title array defaults
    	$title = bbp_parse_args( $title, array(
    		'text'   => '',
    		'format' => '%s'
    	), 'title' );
    
    	// Get the formatted raw title
    	$title = sprintf( $title['format'], $title['text'] );
    
    	// Filter the raw title
    	$title = apply_filters( 'bbp_raw_title', $title, $sep, $seplocation );
    
    	// Compare new title with original title
    	if ( $title === $_title )
    		return $title;
    
    	// Temporary separator, for accurate flipping, if necessary
    	$t_sep  = '%WP_TITILE_SEP%';
    	$prefix = '';
    
    	if ( !empty( $title ) )
    		$prefix = " $sep ";
    
    	// sep on right, so reverse the order
    	if ( 'right' === $seplocation ) {
    		$title_array = array_reverse( explode( $t_sep, $title ) );
    		$title       = implode( " $sep ", $title_array ) . $prefix;
    
    	// sep on left, do not reverse
    	} else {
    		$title_array = explode( $t_sep, $title );
    		$title       = $prefix . implode( " $sep ", $title_array );
    	}
    
    	// Filter and return
    	return apply_filters( 'bbp_title', $title, $sep, $seplocation );
    }
    
    add_filter( 'wp_title', 'my_prefix_bbp_title', 9, 3 );

    matt_peapod
    Participant

    @matt_peapod

    Hey,

    I found the same issue. In my case I patched bbPress to bail if the page isn’t a bbpress page. so in bbpress/includes/common/template.php line 2504 (include bbp_title() function, bbpress 2.4):

    if (!is_bbpress()) {
      return $title;
    }

    This must be a bug. Where can I submit a patch for this, or check if it’s a known bug?

    Thanks,
    Matt


    Nadiamode
    Participant

    @nadiamode

    i have same problem, this happen many days ago still no update
    i have to patch myself with matt_peapod’s method it’s work and easiest


    @matt_peapod

    youcan report bug here https://bbpress.trac.wordpress.org/timeline


    ubound
    Participant

    @ubound

    Just to chime in: me too! My bad, I didn’t notice it at all till today. If you use custom Genesis title feature for search it will display but who has time to go through all old posts and add custom titles. Hope there will be fix for this.

    See this bbPress Trac ticket for more information, the fix will be included with bbPress 2.4.1
    https://bbpress.trac.wordpress.org/ticket/2405

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar