[wp-trac] [WordPress Trac] #15256: ?cat=## permalinks do not redirect when category is a parent

WordPress Trac wp-trac at lists.automattic.com
Tue Aug 30 01:07:34 UTC 2011


#15256: ?cat=## permalinks do not redirect when category is a parent
-------------------------------------+-----------------------
 Reporter:  froman118                |       Owner:
     Type:  defect (bug)             |      Status:  reopened
 Priority:  high                     |   Milestone:  3.3
Component:  Canonical                |     Version:  3.0.1
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |
-------------------------------------+-----------------------
Changes (by SergeyBiryukov):

 * keywords:  needs-patch => has-patch needs-testing


Comment:

 Replying to [comment:5 dd32]:
 > A quick hack "hack" would be to restore a block like this before the
 current taxonomy redirection code:
 > {{{
 >               } elseif ( is_category() && !empty($_GET['cat']) ) {
 >                       if ( $redirect_url = get_term_link(
 (int)$_GET['cat'], 'category') )
 >                               $redirect['query'] =
 remove_query_arg('cat', $redirect['query']);
 > }}}
 > however, that has the downside that it'll probably break on other
 taxonomy queries, or multi-query_var queries, which is what the current
 code was designed to fix.

 [attachment:15256.patch] restores this block along with the condition from
 [10396], to prevent redirect on ?cat=1,2. Doesn't seem to break anything
 so far, but needs more testing.

 Or is there a better way to fix this?

 Replying to [comment:7 minaguib]:
 > 3. User goes to URL: /page/2?cat=5
 > 4. Which is a broken/invalid URL.  Instead of seeing the listing for
 page 2, they see the homepage

 Can't reproduce this. URL like that still shows page 2 of category 5.
 Didn't check 3.2.1 though, only 3.3-trunk.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15256#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list