Reply To: Can't change forum's index meta title
ok, the answer is somewhere in this function
function bbp_title( $title = '', $sep = '»', $seplocation = '' ) {
// Title array
$new_title = array();
/** Archives **************************************************************/
// Forum Archive
if ( bbp_is_forum_archive() ) {
$new_title['text'] = bbp_get_forum_archive_title();
// Topic Archive
} elseif ( bbp_is_topic_archive() ) {
$new_title['text'] = bbp_get_topic_archive_title();
/** Edit ******************************************************************/
// Forum edit page
} elseif ( bbp_is_forum_edit() ) {
$new_title['text'] = bbp_get_forum_title();
$new_title['format'] = esc_attr__( 'Forum Edit: %s', 'bbpress' );
// Topic edit page
} elseif ( bbp_is_topic_edit() ) {
$new_title['text'] = bbp_get_topic_title();
$new_title['format'] = esc_attr__( 'Topic Edit: %s', 'bbpress' );
// Reply edit page
} elseif ( bbp_is_reply_edit() ) {
$new_title['text'] = bbp_get_reply_title();
$new_title['format'] = esc_attr__( 'Reply Edit: %s', 'bbpress' );
// Topic tag edit page
} elseif ( bbp_is_topic_tag_edit() ) {
$new_title['text'] = bbp_get_topic_tag_name();
$new_title['format'] = esc_attr__( 'Topic Tag Edit: %s', 'bbpress' );
/** Singles ***************************************************************/
// Forum page
} elseif ( bbp_is_single_forum() ) {
$new_title['text'] = bbp_get_forum_title();
$new_title['format'] = esc_attr__( 'Forum: %s', 'bbpress' );
// Topic page
} elseif ( bbp_is_single_topic() ) {
$new_title['text'] = bbp_get_topic_title();
$new_title['format'] = esc_attr__( 'Topic: %s', 'bbpress' );
// Replies
} elseif ( bbp_is_single_reply() ) {
$new_title['text'] = bbp_get_reply_title();
// Topic tag page
} elseif ( bbp_is_topic_tag() || get_query_var( 'bbp_topic_tag' ) ) {
$new_title['text'] = bbp_get_topic_tag_name();
$new_title['format'] = esc_attr__( 'Topic Tag: %s', 'bbpress' );
/** Users *****************************************************************/
// Profile page
} elseif ( bbp_is_single_user() ) {
// User is viewing their own profile
if ( bbp_is_user_home() ) {
$new_title['text'] = esc_attr_x( 'Your', 'User viewing his/her own profile', 'bbpress' );
// User is viewing someone else's profile (so use their display name)
} else {
$new_title['text'] = sprintf( esc_attr_x( "%s's", 'User viewing another users profile', 'bbpress' ), get_userdata( bbp_get_user_id() )->display_name );
}
// User topics created
if ( bbp_is_single_user_topics() ) {
$new_title['format'] = esc_attr__( "%s Topics", 'bbpress' );
// User rueplies created
} elseif ( bbp_is_single_user_replies() ) {
$new_title['format'] = esc_attr__( "%s Replies", 'bbpress' );
// User favorites
} elseif ( bbp_is_favorites() ) {
$new_title['format'] = esc_attr__( "%s Favorites", 'bbpress' );
// User subscriptions
} elseif ( bbp_is_subscriptions() ) {
$new_title['format'] = esc_attr__( "%s Subscriptions", 'bbpress' );
// User "home"
} else {
$new_title['format'] = esc_attr__( "%s Profile", 'bbpress' );
}
// Profile edit page
} elseif ( bbp_is_single_user_edit() ) {
// Current user
if ( bbp_is_user_home_edit() ) {
$new_title['text'] = esc_attr__( 'Edit Your Profile', 'bbpress' );
// Other user
} else {
$new_title['text'] = get_userdata( bbp_get_user_id() )->display_name;
$new_title['format'] = esc_attr__( "Edit %s's Profile", 'bbpress' );
}
/** Views *****************************************************************/
// Views
} elseif ( bbp_is_single_view() ) {
$new_title['text'] = bbp_get_view_title();
$new_title['format'] = esc_attr__( 'View: %s', 'bbpress' );
/** Search ****************************************************************/
// Search
} elseif ( bbp_is_search() ) {
$new_title['text'] = bbp_get_search_title();
}
// This filter is deprecated. Use 'bbp_before_title_parse_args' instead.
$new_title = apply_filters( 'bbp_raw_title_array', $new_title );
// Set title array defaults
$new_title = bbp_parse_args( $new_title, array(
'text' => $title,
'format' => '%s'
), 'title' );
// Get the formatted raw title
$new_title = sprintf( $new_title['format'], $new_title['text'] );
// Filter the raw title
$new_title = apply_filters( 'bbp_raw_title', $new_title, $sep, $seplocation );
// Compare new title with original title
if ( $new_title === $title )
return $title;
// Temporary separator, for accurate flipping, if necessary
$t_sep = '%WP_TITILE_SEP%';
$prefix = '';
if ( !empty( $new_title ) )
$prefix = " $sep ";
// sep on right, so reverse the order
if ( 'right' === $seplocation ) {
$new_title_array = array_reverse( explode( $t_sep, $new_title ) );
$new_title = implode( " $sep ", $new_title_array ) . $prefix;
// sep on left, do not reverse
} else {
$new_title_array = explode( $t_sep, $new_title );
$new_title = $prefix . implode( " $sep ", $new_title_array );
}
// Filter and return
return apply_filters( 'bbp_title', $new_title, $sep, $seplocation );
}
a filter such as
function amend_title () {
if ( bbp_is_single_forum() ) {
$new_title['text'] = 'YA book forum' ;
$new_title['format'] = esc_attr__( 'YA book Forum', 'bbpress' );
}
return $new_title;
}
add_filter('bbp_before_title_parse_args', 'amend_title' );
should sort it but doesn’t, and I’m too tired to work out why 🙂
Over to you !