Make WordPress Core

Ticket #42108: pass_the_return_from_wp_redirect_on.patch

File pass_the_return_from_wp_redirect_on.patch, 1.5 KB (added by Drivingralle, 6 years ago)

pass the return from wp_redirect on

  • wp-includes/pluggable.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    12611261}
    12621262endif;
    12631263
    1264 if ( !function_exists('wp_safe_redirect') ) :
     1264if ( ! function_exists( 'wp_safe_redirect' ) ) :
    12651265/**
    12661266 * Performs a safe (local) redirect, using wp_redirect().
    12671267 *
     
    12761276 * @since 2.3.0
    12771277 *
    12781278 * @param string $location The path to redirect to.
    1279  * @param int    $status   Status code to use.
     1279 * @param int $status Status code to use.
     1280 *
     1281 * @return bool $redirect   Pass the return from wp_redirect on
    12801282 */
    1281 function wp_safe_redirect($location, $status = 302) {
     1283function wp_safe_redirect( $location, $status = 302 ) {
    12821284
    12831285        // Need to look at the URL the way it will end up in wp_redirect()
    1284         $location = wp_sanitize_redirect($location);
     1286        $location = wp_sanitize_redirect( $location );
    12851287
    12861288        /**
    12871289         * Filters the redirect fallback URL for when the provided redirect is not safe (local).
     
    12891291         * @since 4.3.0
    12901292         *
    12911293         * @param string $fallback_url The fallback URL to use by default.
    1292          * @param int    $status      The redirect status.
     1294         * @param int $status The redirect status.
    12931295         */
    12941296        $location = wp_validate_redirect( $location, apply_filters( 'wp_safe_redirect_fallback', admin_url(), $status ) );
    12951297
    1296         wp_redirect($location, $status);
     1298        return wp_redirect( $location, $status );
    12971299}
    12981300endif;
    12991301