WordPress开发者和主题制作者的搜索引擎



remove_query_arg ›

Since1.5.0
已弃用n/a
remove_query_arg ( $key, $query = false )
参数: (2)
  • (string|array) $key Query key or keys to remove.
    Required: Yes
  • (bool|string) $query Optional. When false uses the current URL. Default false.
    Required: No
    默认: false
返回:
  • (string) New URL query string.
定义在:
文档:

Removes an item or items from a query string.



源码

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