wp_redirect filter-hookWP 2.1.0

Filters the redirect location.

Usage

add_filter( 'wp_redirect', 'wp_kama_redirect_filter', 10, 2 );

/**
 * Function for `wp_redirect` filter-hook.
 * 
 * @param string $location The path or URL to redirect to.
 * @param int    $status   The HTTP response status code to use.
 *
 * @return string
 */
function wp_kama_redirect_filter( $location, $status ){

	// filter...
	return $location;
}
$location(string)
The path or URL to redirect to.
$status(int)
The HTTP response status code to use.

Changelog

Since 2.1.0 Introduced.

Where the hook is called

wp_redirect()
wp_redirect
wp-includes/pluggable.php 1396
$location = apply_filters( 'wp_redirect', $location, $status );

Where the hook is used in WordPress

wp-includes/class-wp-customize-manager.php 1943
add_filter( 'wp_redirect', array( $this, 'add_state_query_params' ) );