From 673ff22b2b3a718920c7845003e299faf2d1974c Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 1 Feb 2018 15:06:35 +0000 Subject: [PATCH] Canonical: Add `$x_redirect_by` parameter to `wp_redirect()` that allows applications doing the redirect to identify themselves. This complements the `x_redirect_by` filter added in [42408]. Props NathanAtmoz, johnbillion. Fixes #42313. Built from https://develop.svn.wordpress.org/trunk@42633 git-svn-id: http://core.svn.wordpress.org/trunk@42462 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/pluggable.php | 9 +++++---- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index 9af88a6ea2..da53ee3d25 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -1189,11 +1189,12 @@ if ( ! function_exists( 'wp_redirect' ) ) : * * @global bool $is_IIS * - * @param string $location The path or URL to redirect to. - * @param int $status Optional. HTTP response status code to use. Default '302' (Moved Temporarily). + * @param string $location The path or URL to redirect to. + * @param int $status Optional. HTTP response status code to use. Default '302' (Moved Temporarily). + * @param string $x_redirect_by Optional. The application doing the redirect. Default 'WordPress'. * @return bool False if the redirect was cancelled, true otherwise. */ - function wp_redirect( $location, $status = 302 ) { + function wp_redirect( $location, $status = 302, $x_redirect_by = 'WordPress' ) { global $is_IIS; /** @@ -1237,7 +1238,7 @@ if ( ! function_exists( 'wp_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 ); + $x_redirect_by = apply_filters( 'x_redirect_by', $x_redirect_by, $status, $location ); if ( is_string( $x_redirect_by ) ) { header( "X-Redirect-By: $x_redirect_by" ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 5be33c2f48..6fe374e06c 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '5.0-alpha-42632'; +$wp_version = '5.0-alpha-42633'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.