mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-29 07:37:44 +02:00
Canonical: Introduce x_redirect_by
filter that allows applications to identify themselves via X-Redirect-By
header when they're doing a redirect.
Props joostdevalk. Fixes #42313. Built from https://develop.svn.wordpress.org/trunk@42408 git-svn-id: http://core.svn.wordpress.org/trunk@42237 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
cb53982d1f
commit
0bc86bc220
@ -1226,6 +1226,22 @@ if ( ! function_exists( 'wp_redirect' ) ) :
|
|||||||
status_header( $status ); // This causes problems on IIS and some FastCGI setups
|
status_header( $status ); // This causes problems on IIS and some FastCGI setups
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters the X-Redirect-By header.
|
||||||
|
*
|
||||||
|
* Allows applications to identify themselves when they're doing a redirect.
|
||||||
|
*
|
||||||
|
* @since 5.0.0
|
||||||
|
*
|
||||||
|
* @param string $x_redirect_by The application doing the redirect.
|
||||||
|
* @param int $status Status code to use.
|
||||||
|
* @param string $location The path to redirect to.
|
||||||
|
*/
|
||||||
|
$x_redirect_by = apply_filters( 'x_redirect_by', 'WordPress', $status, $location );
|
||||||
|
if ( is_string( $x_redirect_by ) ) {
|
||||||
|
header( sprintf( "X-Redirect-By: %s", $x_redirect_by ) );
|
||||||
|
}
|
||||||
|
|
||||||
header( "Location: $location", true, $status );
|
header( "Location: $location", true, $status );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.0-alpha-42407';
|
$wp_version = '5.0-alpha-42408';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user