bbp_redirect_canonical( string $redirect_url )

Remove the canonical redirect to allow pretty pagination


Description Description


Parameters Parameters

$redirect_url

(Required) Redirect url


Top ↑

Return Return

(bool|string) False if it's a topic/forum and their first page, otherwise the redirect url


Top ↑

Source Source

File: includes/core/theme-compat.php

function bbp_redirect_canonical( $redirect_url ) {

	// Canonical is for the beautiful
	if ( bbp_use_pretty_urls() ) {

		// If viewing beyond page 1 of several
		if ( 1 < bbp_get_paged() ) {

			// Only on single topics...
			if ( bbp_is_single_topic() ) {
				$redirect_url = false;

			// ...and single forums...
			} elseif ( bbp_is_single_forum() ) {
				$redirect_url = false;

			// ...and single replies...
			} elseif ( bbp_is_single_reply() ) {
				$redirect_url = false;

			// ...and any single anything else...
			//
			// @todo - Find a more accurate way to disable paged canonicals for
			//          paged shortcode usage within other posts.
			} elseif ( is_page() || is_singular() ) {
				$redirect_url = false;
			}

		// If editing a topic
		} elseif ( bbp_is_topic_edit() ) {
			$redirect_url = false;

		// If editing a reply
		} elseif ( bbp_is_reply_edit() ) {
			$redirect_url = false;
		}
	}

	return $redirect_url;
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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