diff --git a/wp-admin/customize.php b/wp-admin/customize.php index 6ee2de007a..bfc96233eb 100644 --- a/wp-admin/customize.php +++ b/wp-admin/customize.php @@ -21,6 +21,7 @@ $url = wp_unslash( $url ); $url = wp_validate_redirect( $url, home_url( '/' ) ); if ( $return ) { $return = wp_unslash( $return ); + $return = remove_query_arg( wp_removable_query_args(), $return ); $return = wp_validate_redirect( $return ); } if ( ! $return ) { diff --git a/wp-admin/includes/misc.php b/wp-admin/includes/misc.php index 83e7548175..d65d22b2d7 100644 --- a/wp-admin/includes/misc.php +++ b/wp-admin/includes/misc.php @@ -865,24 +865,7 @@ function post_form_autocomplete_off() { * @since 4.2.0 */ function wp_admin_canonical_url() { - $removable_query_args = array( - 'message', 'settings-updated', 'saved', - 'update', 'updated', 'activated', - 'activate', 'deactivate', 'locked', - 'deleted', 'trashed', 'untrashed', - 'enabled', 'disabled', 'skipped', - 'spammed', 'unspammed', - 'error', - ); - - /** - * Filter the list of URL parameters to remove. - * - * @since 4.2.0 - * - * @param array $removable_query_args An array of parameters to remove from the URL. - */ - $removable_query_args = apply_filters( 'removable_query_args', $removable_query_args ); + $removable_query_args = wp_removable_query_args(); if ( empty( $removable_query_args ) ) { return; diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 006cb6cb7e..9206f9bffd 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -824,6 +824,47 @@ function remove_query_arg( $key, $query = false ) { return add_query_arg( $key, false, $query ); } +/** + * Returns an array of single-use query variable names that can be removed from a URL. + * + * @since 4.4.0 + * + * @return array An array of parameters to remove from the URL. + */ +function wp_removable_query_args() { + $removable_query_args = array( + 'activate', + 'activated', + 'approved', + 'deactivate', + 'deleted', + 'disabled', + 'enabled', + 'error', + 'locked', + 'message', + 'same', + 'saved', + 'settings-updated', + 'skipped', + 'spammed', + 'trashed', + 'unspammed', + 'untrashed', + 'update', + 'updated', + ); + + /** + * Filter the list of query variables to remove. + * + * @since 4.2.0 + * + * @param array $removable_query_args An array of query variables to remove from a URL. + */ + return apply_filters( 'removable_query_args', $removable_query_args ); +} + /** * Walks the array while sanitizing the contents. * diff --git a/wp-includes/version.php b/wp-includes/version.php index ac0bd5fb8f..d19a8d1297 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-33848'; +$wp_version = '4.4-alpha-33849'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.