wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



remove_query_arg › WordPress Function

Od1.5.0
Przestarzałyn/a
remove_query_arg ( $key, $query = false )
Parametry: (2)
  • (string|string[]) $key Query key or keys to remove.
    Wymagane: Tak
  • (false|string) $query Optional. When false uses the current URL. Default false.
    Wymagane: Nie
    Domyślny: false
Powrót:
  • (string) New URL query string.
Zdefiniowane na:
Codex:

Removes an item or items from a query string.

Important: The return value of remove_query_arg() is not escaped by default. Output should be late-escaped with esc_url() or similar to help prevent vulnerability to cross-site scripting (XSS) attacks.


Źródło

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 );
}