bbp_get_topics_pagination_base( int $forum_id )

Return the base URL used inside of pagination links


Description Description


Parameters Parameters

$forum_id

(Required)


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/topics/template.php

function bbp_get_topics_pagination_base( $forum_id = 0 ) {

	// If pretty permalinks are enabled, make our pagination pretty
	if ( bbp_use_pretty_urls() ) {

		// User's topics
		if ( bbp_is_single_user_topics() ) {
			$base = bbp_get_user_topics_created_url( bbp_get_displayed_user_id() );

		// User's engagements
		} elseif ( bbp_is_single_user_engagements() ) {
			$base = bbp_get_user_engagements_url( bbp_get_displayed_user_id() );

		// User's favorites
		} elseif ( bbp_is_favorites() ) {
			$base = bbp_get_favorites_permalink( bbp_get_displayed_user_id() );

		// User's subscriptions
		} elseif ( bbp_is_subscriptions() ) {
			$base = bbp_get_subscriptions_permalink( bbp_get_displayed_user_id() );

		// Root profile page
		} elseif ( bbp_is_single_user() ) {
			$base = bbp_get_user_profile_url( bbp_get_displayed_user_id() );

		// View
		} elseif ( bbp_is_single_view() ) {
			$base = bbp_get_view_url();

		// Topic tag
		} elseif ( bbp_is_topic_tag() ) {
			$base = bbp_get_topic_tag_link();

		// Page or single post
		} elseif ( is_page() || is_single() ) {
			$base = get_permalink();

		// Forum archive
		} elseif ( bbp_is_forum_archive() ) {
			$base = bbp_get_forums_url();

		// Topic archive
		} elseif ( bbp_is_topic_archive() ) {
			$base = bbp_get_topics_url();

		// Default
		} else {
			$base = get_permalink( $forum_id );
		}

		// Use pagination base
		$base = trailingslashit( $base ) . user_trailingslashit( bbp_get_paged_slug() . '/%#%/' );

	// Unpretty pagination
	} else {
		$base = add_query_arg( 'paged', '%#%' );
	}

	// Filter & return
	return apply_filters( 'bbp_get_topics_pagination_base', $base, $forum_id );
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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