redirect_canonical filter-hookWP 2.3.0

Filters the canonical redirect URL.

Returning false to this filter will cancel the redirect.

Usage

add_filter( 'redirect_canonical', 'wp_kama_redirect_canonical_filter', 10, 2 );

/**
 * Function for `redirect_canonical` filter-hook.
 * 
 * @param string $redirect_url  The redirect URL.
 * @param string $requested_url The requested URL.
 *
 * @return string
 */
function wp_kama_redirect_canonical_filter( $redirect_url, $requested_url ){

	// filter...
	return $redirect_url;
}
$redirect_url(string)
The redirect URL.
$requested_url(string)
The requested URL.

Changelog

Since 2.3.0 Introduced.

Where the hook is called

redirect_canonical()
redirect_canonical
wp-includes/canonical.php 789
$redirect_url = apply_filters( 'redirect_canonical', $redirect_url, $requested_url );

Where the hook is used in WordPress

Usage not found.