Make WordPress Core


Ignore:
Timestamp:
09/02/2015 11:28:11 AM (9 years ago)
Author:
johnbillion
Message:

Introduce wp_removable_query_args(), which returns an array of single-use query variables which can be removed from a URL.

Also applies the function to the return URL when the Customizer is closed.

Fixes #32692
Props swissspidy, Mte90

File:
1 edited

Legend:

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

    r33747 r33849  
    823823    }
    824824    return add_query_arg( $key, false, $query );
     825}
     826
     827/**
     828 * Returns an array of single-use query variable names that can be removed from a URL.
     829 *
     830 * @since 4.4.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        'activate',
     837        'activated',
     838        'approved',
     839        'deactivate',
     840        'deleted',
     841        'disabled',
     842        'enabled',
     843        'error',
     844        'locked',
     845        'message',
     846        'same',
     847        'saved',
     848        'settings-updated',
     849        'skipped',
     850        'spammed',
     851        'trashed',
     852        'unspammed',
     853        'untrashed',
     854        'update',
     855        'updated',
     856    );
     857
     858    /**
     859     * Filter the list of query variables to remove.
     860     *
     861     * @since 4.2.0
     862     *
     863     * @param array $removable_query_args An array of query variables to remove from a URL.
     864     */
     865    return apply_filters( 'removable_query_args', $removable_query_args );
    825866}
    826867
Note: See TracChangeset for help on using the changeset viewer.