bbp_filter_modify_page_title( string $new_title = '', string $old_title = '', string $sep = '' )

Add the topic title to the <title> if viewing a single group forum topic


Description Description


Parameters Parameters

$new_title

(Optional) The title to filter

Default value: ''

$old_title

(Optional) (Not used)

Default value: ''

$sep

(Optional) The separator to use

Default value: ''


Top ↑

Return Return

(string) The possibly modified title


Top ↑

Source Source

File: includes/extend/buddypress/functions.php

function bbp_filter_modify_page_title( $new_title = '', $old_title = '', $sep = '' ) {

	// Only filter if group forums are active
	if ( bbp_is_group_forums_active() ) {

		// Only filter for single group forum topics
		if ( bp_is_group_forum_topic() || bp_is_group_forum_topic_edit() ) {

			// Get the topic
			$topic = get_posts( array(
				'name'        => bp_action_variable( 1 ),
				'post_status' => array_keys( bbp_get_topic_statuses() ),
				'post_type'   => bbp_get_topic_post_type(),
				'numberposts' => 1
			) );

			// Add the topic title to the <title>
			$new_title .= bbp_get_topic_title( $topic[0]->ID ) . ' ' . $sep . ' ';
		}
	}

	// Return the title
	return $new_title;
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.