[wp-trac] [WordPress Trac] #16627: Rewrite query vars are stripped from custom taxonomy page URLs via redirect_canonical()
WordPress Trac
wp-trac at lists.automattic.com
Thu Feb 24 02:59:44 UTC 2011
#16627: Rewrite query vars are stripped from custom taxonomy page URLs via
redirect_canonical()
---------------------------+-----------------------------
Reporter: gnoodl | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Rewrite Rules | Version: 3.1
Severity: normal | Keywords:
---------------------------+-----------------------------
In wp-includes/canonical.php, version 3.1 changed lines 155-177 from
{{{
if ( $term_count <= 1 && !empty($obj->term_id) && ( $tax_url =
get_term_link((int)$obj->term_id, $obj->taxonomy) )
&& !is_wp_error($tax_url) && $redirect['query'] ) {
/* Not important */
$tax_url = parse_url($tax_url);
if ( ! 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"
$redirect['path'] = $tax_url['path'];
}
}
}}}
to (lines 153-174)
{{{
if ( $term_count <= 1 && !empty($obj->term_id) && ( $tax_url =
get_term_link((int)$obj->term_id, $obj->taxonomy) ) &&
!is_wp_error($tax_url) ) {
if ( !empty($redirect['query']) ) {
/* Not important */
}
$tax_url = parse_url($tax_url);
if ( ! 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"
$redirect['path'] = $tax_url['path'];
}
}
}}}
The difference here is that in the new version, the `$redirect['path']` is
'''always''' set to the taxonomy path, eliminating any query vars added
via custom rewrite rule, regardless of whether there are query vars in
`$redirect['query']` or not.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16627>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list