bp_do_404( string $redirect = 'remove_canonical_direct' )

Trigger a 404.


Parameters Parameters

$redirect

(string) (Optional) If 'remove_canonical_direct', remove WordPress' "helpful" redirect_canonical action. Default: 'remove_canonical_redirect'.

Default value: 'remove_canonical_direct'


Source Source

File: bp-core/bp-core-functions.php

function bp_do_404( $redirect = 'remove_canonical_direct' ) {
	global $wp_query;

	/**
	 * Fires inside the triggering of a 404.
	 *
	 * @since 1.5.0
	 *
	 * @param string $redirect Redirect type used to determine if redirect_canonical
	 *                         function should be be removed.
	 */
	do_action( 'bp_do_404', $redirect );

	$wp_query->set_404();
	status_header( 404 );
	nocache_headers();

	if ( 'remove_canonical_direct' === $redirect ) {
		remove_action( 'template_redirect', 'redirect_canonical' );
	}
}


Top ↑

Changelog Changelog

Changelog
Version Description
1.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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