WordPress.org

Make WordPress Core


Ignore:
Timestamp:
06/16/2015 05:25:32 AM (7 years ago)
Author:
dd32
Message:

Add a filter to wp_safe_redirect() for the fallback URL.
Props anubisthejackle. Fixes #22612

File:
1 edited

Legend:

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

    r32733 r32793  
    12611261 * list.
    12621262 *
    1263  * If the host is not allowed, then the redirect is to wp-admin on the siteurl
     1263 * If the host is not allowed, then the redirect defaults to wp-admin on the siteurl
    12641264 * instead. This prevents malicious redirects which redirect to another host,
    12651265 * but only used in a few places.
     
    12721272    $location = wp_sanitize_redirect($location);
    12731273
    1274     $location = wp_validate_redirect($location, admin_url());
     1274    /**
     1275     * Filter the redirect fallback URL for when the provided redirect is not safe (local).
     1276     *
     1277     * @since 4.3.0
     1278     *
     1279     * @param string $fallback_url  The fallback URL to use by default.
     1280     * @param int    $status        The redirect status.
     1281     */
     1282    $location = wp_validate_redirect( $location, apply_filters( 'wp_safe_redirect_fallback', admin_url(), $status ) );
    12751283
    12761284    wp_redirect($location, $status);
Note: See TracChangeset for help on using the changeset viewer.