WordPress.org

Make WordPress Core

Ticket #32692: 32692.diff

File 32692.diff, 2.4 KB (added by swissspidy, 4 years ago)

Another approach like in the original suggestion.

  • src/wp-admin/customize.php

    diff --git src/wp-admin/customize.php src/wp-admin/customize.php
    index e3ea406..8f620e9 100644
    $url = wp_unslash( $url ); 
    2121$url = wp_validate_redirect( $url, home_url( '/' ) );
    2222if ( $return ) {
    2323        $return = wp_unslash( $return );
     24        $return = remove_query_arg( wp_removable_query_args(), $return );
    2425        $return = wp_validate_redirect( $return );
    2526}
    2627if ( ! $return ) {
  • src/wp-admin/includes/misc.php

    diff --git src/wp-admin/includes/misc.php src/wp-admin/includes/misc.php
    index 3f218fa..e55d85d 100644
    function post_form_autocomplete_off() { 
    865865 * @since 4.2.0
    866866 */
    867867function wp_admin_canonical_url() {
    868         $removable_query_args = array(
    869                 'message', 'settings-updated', 'saved',
    870                 'update', 'updated', 'activated',
    871                 'activate', 'deactivate', 'locked',
    872                 'deleted', 'trashed', 'untrashed',
    873                 'enabled', 'disabled', 'skipped',
    874                 'spammed', 'unspammed',
    875         );
    876 
    877         /**
    878          * Filter the list of URL parameters to remove.
    879          *
    880          * @since 4.2.0
    881          *
    882          * @param array $removable_query_args An array of parameters to remove from the URL.
    883          */
    884         $removable_query_args = apply_filters( 'removable_query_args', $removable_query_args );
     868        $removable_query_args = wp_removable_query_args();
    885869
    886870        if ( empty( $removable_query_args ) ) {
    887871                return;
  • src/wp-includes/functions.php

    diff --git src/wp-includes/functions.php src/wp-includes/functions.php
    index 1dce3aa..43f1c39 100644
    function remove_query_arg( $key, $query = false ) { 
    825825}
    826826
    827827/**
     828 * Returns the list of URL parameters to remove.
     829 *
     830 * @since 4.3.0
     831 *
     832 * @return array An array of parameters to remove from the URL.
     833 */
     834function wp_removable_query_args() {
     835        $removable_query_args = array(
     836                'message', 'settings-updated', 'saved',
     837                'update', 'updated', 'activated',
     838                'activate', 'deactivate', 'locked',
     839                'deleted', 'trashed', 'untrashed',
     840                'enabled', 'disabled', 'skipped',
     841                'spammed', 'unspammed',
     842        );
     843
     844        /**
     845         * Filter the list of URL parameters to remove.
     846         *
     847         * @since 4.2.0
     848         *
     849         * @param array $removable_query_args An array of parameters to remove from the URL.
     850         */
     851        $removable_query_args = apply_filters( 'removable_query_args', $removable_query_args );
     852
     853        return $removable_query_args;
     854}
     855
     856/**
    828857 * Walks the array while sanitizing the contents.
    829858 *
    830859 * @since 0.71