_remove_qs_args_if_not_in_url
函数
_remove_qs_args_if_not_in_url ( $query_string, $args_to_check, $url )
- Access
- Private
- 参数
-
-
(string)
$query_string- Required: 是
-
(array)
$args_to_check- Required: 是
-
(string)
$url- Required: 是
-
(string)
- 返回值
-
- (string) The altered query string
- 定义位置
-
-
wp-includes/canonical.php
, line 823
-
wp-includes/canonical.php
- 引入
- 3.4.0
- 弃用
- –
Removes arguments from a query string if they are not present in a URL
DO NOT use this in plugin code.
function _remove_qs_args_if_not_in_url( $query_string, array $args_to_check, $url ) { $parsed_url = parse_url( $url ); if ( ! empty( $parsed_url['query'] ) ) { parse_str( $parsed_url['query'], $parsed_query ); foreach ( $args_to_check as $qv ) { if ( ! isset( $parsed_query[ $qv ] ) ) { $query_string = remove_query_arg( $qv, $query_string ); } } } else { $query_string = remove_query_arg( $args_to_check, $query_string ); } return $query_string; }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。