mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
In canonical.php
:
* Clarify some docs * `redirect_canonical()` inconsistently returns `null` or `false` when bailing - can simply return. See #32444. Built from https://develop.svn.wordpress.org/trunk@32529 git-svn-id: http://core.svn.wordpress.org/trunk@32499 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9b3271f635
commit
3f32bf7bc0
@ -33,8 +33,7 @@
|
|||||||
* @param string $requested_url Optional. The URL that was requested, used to
|
* @param string $requested_url Optional. The URL that was requested, used to
|
||||||
* figure if redirect is needed.
|
* figure if redirect is needed.
|
||||||
* @param bool $do_redirect Optional. Redirect to the new URL.
|
* @param bool $do_redirect Optional. Redirect to the new URL.
|
||||||
* @return null|false|string Null, if redirect not needed. False, if redirect
|
* @return null|string Null, if redirect not needed, or the string of the URL
|
||||||
* not needed or the string of the URL
|
|
||||||
*/
|
*/
|
||||||
function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
||||||
global $wp_rewrite, $is_IIS, $wp_query, $wpdb;
|
global $wp_rewrite, $is_IIS, $wp_query, $wpdb;
|
||||||
@ -447,8 +446,9 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
|||||||
$redirect_url .= '?' . $redirect['query'];
|
$redirect_url .= '?' . $redirect['query'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !$redirect_url || $redirect_url == $requested_url )
|
if ( ! $redirect_url || $redirect_url == $requested_url ) {
|
||||||
return false;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Hex encoded octets are case-insensitive.
|
// Hex encoded octets are case-insensitive.
|
||||||
if ( false !== strpos($requested_url, '%') ) {
|
if ( false !== strpos($requested_url, '%') ) {
|
||||||
@ -472,8 +472,10 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
|||||||
*/
|
*/
|
||||||
$redirect_url = apply_filters( 'redirect_canonical', $redirect_url, $requested_url );
|
$redirect_url = apply_filters( 'redirect_canonical', $redirect_url, $requested_url );
|
||||||
|
|
||||||
if ( !$redirect_url || $redirect_url == $requested_url ) // yes, again -- in case the filter aborted the request
|
// yes, again -- in case the filter aborted the request
|
||||||
return false;
|
if ( ! $redirect_url || $redirect_url == $requested_url ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( $do_redirect ) {
|
if ( $do_redirect ) {
|
||||||
// protect against chained redirects
|
// protect against chained redirects
|
||||||
@ -483,7 +485,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
|||||||
} else {
|
} else {
|
||||||
// Debug
|
// Debug
|
||||||
// die("1: $redirect_url<br />2: " . redirect_canonical( $redirect_url, false ) );
|
// die("1: $redirect_url<br />2: " . redirect_canonical( $redirect_url, false ) );
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return $redirect_url;
|
return $redirect_url;
|
||||||
@ -523,7 +525,7 @@ function _remove_qs_args_if_not_in_url( $query_string, Array $args_to_check, $ur
|
|||||||
*
|
*
|
||||||
* @global wpdb $wpdb WordPress database abstraction object.
|
* @global wpdb $wpdb WordPress database abstraction object.
|
||||||
*
|
*
|
||||||
* @return bool|string The correct URL if one is found. False on failure.
|
* @return false|string The correct URL if one is found. False on failure.
|
||||||
*/
|
*/
|
||||||
function redirect_guess_404_permalink() {
|
function redirect_guess_404_permalink() {
|
||||||
global $wpdb, $wp_rewrite;
|
global $wpdb, $wp_rewrite;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.3-alpha-32528';
|
$wp_version = '4.3-alpha-32529';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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