Make WordPress Core


Ignore:
Timestamp:
11/20/2017 08:23:50 PM (7 years ago)
Author:
johnbillion
Message:

General: Pass on the return value from wp_redirect() for wp_safe_redirect().

This brings the behaviour of the two functions in line with each other.

Props Drivingralle

Fixes 42108

File:
1 edited

Legend:

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

    r42143 r42206  
    12861286 *     exit;
    12871287 *
     1288 * Exiting can also be selectively manipulated by using wp_safe_redirect() as a conditional
     1289 * in conjunction with the {@see 'wp_redirect'} and {@see 'wp_redirect_location'} filters:
     1290 *
     1291 *     if ( wp_safe_redirect( $url ) ) {
     1292 *         exit;
     1293 *     }
     1294 *
    12881295 * @since 2.3.0
     1296 * @since 5.0.0 The return value from wp_redirect() is now passed on.
    12891297 *
    12901298 * @param string $location The path or URL to redirect to.
    12911299 * @param int    $status   Optional. HTTP response status code to use. Default '302' (Moved Temporarily).
     1300 * @return bool  $redirect False if the redirect was cancelled, true otherwise.
    12921301 */
    12931302function wp_safe_redirect($location, $status = 302) {
     
    13061315    $location = wp_validate_redirect( $location, apply_filters( 'wp_safe_redirect_fallback', admin_url(), $status ) );
    13071316
    1308     wp_redirect($location, $status);
     1317    return wp_redirect( $location, $status );
    13091318}
    13101319endif;
Note: See TracChangeset for help on using the changeset viewer.