This page redirects to an external site: https://developer.wordpress.org/reference/functions/remove_query_arg/
Removes an item or list from the query string.
// individual parameter
<?php remove_query_arg( $key, $query ) ?>
// multiple parameters in an array
<?php remove_query_arg( array('$key1', 'key2', 'key3'), $query ) ?>
Assuming we're at the WordPress URL "http://www.example.com/client/?details=value1&type=value2&date=value3"...
Note the use of esc_url() before outputting the link.
<?php
When you want to manipulate a URL that is not of the page your script is in, add the targeted URL in the second parameter as below. The use of esc_url() is not required here, because the value is known to be safe:
// This would output '/client/?type=value2&date=value3'
echo esc_url( remove_query_arg( 'details' ) );
// This would output '/client/'
$arr_params = array( 'details', 'type', 'date');
echo esc_url( remove_query_arg( $arr_params ) );
?>
<?php
// This would output 'http://www.example.com/2014/03/11/'
echo remove_query_arg( 'details', 'http://www.example.com/2014/03/11/?details=value1');
// This would output 'http://www.example.com/2014/03/11/?type=value2&date=value3'
echo remove_query_arg( 'details', 'http://www.example.com/2014/03/11/?details=value1&type=value2&date=value3');
// This would output 'http://www.example.com/2014/03/11/'
$arr_params = array( 'details', 'type', 'date');
echo remove_query_arg( $arr_params, 'http://www..example.com/2014/03/11/?details=value1&type=value2&date=value3');
?>
Since: 1.5.0
remove_query_arg() is located in wp-includes/functions.php.