wp_removable_query_args() WordPress Function

The wp_removable_query_args() function is used to remove unwanted query args from a URL. By default, this function will remove the following query args: 'action', 'message', 'settings-updated', 'updated', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', 'uninstall', 'enable', 'disable', 'preview', 'preview_id', 'preview_nonce', 'logged_in', 'skip_confirm' This function can be useful when you want to clean up a URL before sending it to another page or when you want to make sure that certain query args are not included in a URL.

wp_removable_query_args() #

Returns an array of single-use query variable names that can be removed from a URL.


Return

(string[]) An array of query variable names to remove from the URL.


Top ↑

Source

File: wp-includes/functions.php

function wp_removable_query_args() {
	$removable_query_args = array(
		'activate',
		'activated',
		'admin_email_remind_later',
		'approved',
		'core-major-auto-updates-saved',
		'deactivate',
		'delete_count',
		'deleted',
		'disabled',
		'doing_wp_cron',
		'enabled',
		'error',
		'hotkeys_highlight_first',
		'hotkeys_highlight_last',
		'ids',
		'locked',
		'message',
		'same',
		'saved',
		'settings-updated',
		'skipped',
		'spammed',
		'trashed',
		'unspammed',
		'untrashed',
		'update',
		'updated',
		'wp-post-new-reload',
	);

	/**
	 * Filters the list of query variable names to remove.
	 *
	 * @since 4.2.0
	 *
	 * @param string[] $removable_query_args An array of query variable names to remove from a URL.
	 */
	return apply_filters( 'removable_query_args', $removable_query_args );
}


Top ↑

Changelog

Changelog
VersionDescription
4.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More