function remove_query_arg( $key, $query=false ) {}

Removes an item or list from the query string.


  • string|array $key: Query key or keys to remove.
  • bool $query: When false uses the $_SERVER value.

Return values

returns:New URL query string.

Source code

function remove_query_arg( $key, $query=false ) {

	if ( is_array( $key ) ) { // removing multiple keys

		foreach ( $key as $k )

			$query = add_query_arg( $k, false, $query );

		return $query;


	return add_query_arg( $key, false, $query );



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: