Make WordPress Core

Ticket #32692: 32692.2.patch

File 32692.2.patch, 1.5 KB (added by Mte90, 9 years ago)

correct patch

  • wp-admin/customize.php

     
    2121$url = wp_validate_redirect( $url, home_url( '/' ) );
    2222if ( $return ) {
    2323        $return = wp_unslash( $return );
     24        $return = wp_admin_canonical_url( $return, false );
    2425        $return = wp_validate_redirect( $return );
    2526}
    2627if ( ! $return ) {
  • wp-admin/includes/misc.php

     
    864864 *
    865865 * @since 4.2.0
    866866 */
    867 function wp_admin_canonical_url() {
     867function wp_admin_canonical_url($url = '', $print = true) {
    868868        $removable_query_args = array(
    869869                'message', 'settings-updated', 'saved',
    870870                'update', 'updated', 'activated',
     
    888888        }
    889889
    890890        // Ensure we're using an absolute URL.
    891         $current_url  = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
     891        if( empty( $url ) ) {
     892                $current_url  = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
     893        } else {
     894                $current_url = $url;
     895        }
    892896        $filtered_url = remove_query_arg( $removable_query_args, $current_url );
     897        if( true === $print ) {
    893898        ?>
    894899        <link id="wp-admin-canonical" rel="canonical" href="<?php echo esc_url( $filtered_url ); ?>" />
    895900        <script>
     
    898903                }
    899904        </script>
    900905<?php
     906        } else {
     907                return esc_url( $filtered_url );
     908        }
    901909}