Make WordPress Core

Changeset 32529


Ignore:
Timestamp:
05/21/2015 08:29:19 PM (10 years ago)
Author:
wonderboymusic
Message:

In canonical.php:

  • Clarify some docs
  • redirect_canonical() inconsistently returns null or false when bailing - can simply return.

See #32444.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/canonical.php

    r31838 r32529  
    3434 *      figure if redirect is needed.
    3535 * @param bool $do_redirect Optional. Redirect to the new URL.
    36  * @return null|false|string Null, if redirect not needed. False, if redirect
    37  *      not needed or the string of the URL
     36 * @return null|string Null, if redirect not needed, or the string of the URL
    3837 */
    3938function redirect_canonical( $requested_url = null, $do_redirect = true ) {
     
    448447    }
    449448
    450     if ( !$redirect_url || $redirect_url == $requested_url )
    451         return false;
     449    if ( ! $redirect_url || $redirect_url == $requested_url ) {
     450        return;
     451    }
    452452
    453453    // Hex encoded octets are case-insensitive.
     
    473473    $redirect_url = apply_filters( 'redirect_canonical', $redirect_url, $requested_url );
    474474
    475     if ( !$redirect_url || $redirect_url == $requested_url ) // yes, again -- in case the filter aborted the request
    476         return false;
     475    // yes, again -- in case the filter aborted the request
     476    if ( ! $redirect_url || $redirect_url == $requested_url ) {
     477        return;
     478    }
    477479
    478480    if ( $do_redirect ) {
     
    484486            // Debug
    485487            // die("1: $redirect_url<br />2: " . redirect_canonical( $redirect_url, false ) );
    486             return false;
     488            return;
    487489        }
    488490    } else {
     
    524526 * @global wpdb $wpdb WordPress database abstraction object.
    525527 *
    526  * @return bool|string The correct URL if one is found. False on failure.
     528 * @return false|string The correct URL if one is found. False on failure.
    527529 */
    528530function redirect_guess_404_permalink() {
Note: See TracChangeset for help on using the changeset viewer.