mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Prevent a notice: don't attempt to parse the query string if it doesn't exist. Props johnjamesjacoby. Fixes #20528.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20669 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
81861e8cf8
commit
6fd24edbec
@ -448,10 +448,14 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
||||
*/
|
||||
function _remove_qs_args_if_not_in_url( $query_string, Array $args_to_check, $url ) {
|
||||
$parsed_url = @parse_url( $url );
|
||||
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 );
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user