Allow Taxonomies to be queried by $_GET parameters on non-taxonomy url's. See #17174
git-svn-id: https://develop.svn.wordpress.org/trunk@17706 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c70a32734f
commit
81abe55c11
@ -164,8 +164,18 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
||||
$redirect['query'] = remove_query_arg( array( 'term', 'taxonomy'), $redirect['query']);
|
||||
}
|
||||
}
|
||||
|
||||
$tax_obj = get_taxonomy( $obj->taxonomy );
|
||||
$tax_query_vars = array_diff( array_keys( $wp_query->query ), array_keys( $_GET ), array( 'taxonomy', 'term', $tax_obj->query_var ) );
|
||||
|
||||
$tax_url = parse_url($tax_url);
|
||||
if ( ! empty($tax_url['query']) ) { // Custom taxonomies may only be accessable via ?taxonomy=..&term=..
|
||||
if ( ! empty($tax_query_vars) ) {
|
||||
foreach ( array( 'taxonomy', 'term', $tax_obj->query_var ) as $qv ) {
|
||||
if ( !empty($wp_query->query[$qv]) )
|
||||
$redirect['query'] = add_query_arg($qv, $wp_query->query[$qv], $redirect['query']);
|
||||
}
|
||||
|
||||
} elseif ( ! empty($tax_url['query']) ) { // Custom taxonomies may only be accessable via ?taxonomy=..&term=..
|
||||
parse_str($tax_url['query'], $query_vars);
|
||||
$redirect['query'] = add_query_arg($query_vars, $redirect['query']);
|
||||
} else { // Taxonomy is accessable via a "pretty-URL"
|
||||
|
Loading…
Reference in New Issue
Block a user