[wp-trac] Re: [WordPress Trac] #8098: trailing p's removed from query by canonical redirect

WordPress Trac wp-trac at lists.automattic.com
Sun Nov 9 21:27:38 GMT 2008


#8098: trailing p's removed from query by canonical redirect
---------------------+------------------------------------------------------
 Reporter:  DD32     |        Owner:  anonymous
     Type:  defect   |       Status:  new      
 Priority:  normal   |    Milestone:  2.7      
Component:  General  |      Version:  2.7      
 Severity:  normal   |   Resolution:           
 Keywords:           |  
---------------------+------------------------------------------------------
Comment (by azaozz):

 Replying to [comment:12 filosofo]:
 > Make it a little longer, and you can trim away beginning or ending "&"s
 that would otherwise be left over by something like {{{'tag=php&p=&'}}} or
 {{{'p=&tag=php'}}}:
 >
 {{{
 $redirect['query'] =
 preg_replace(
 '#^&|(&(?!(p|page_id|cat|tag)=?&[^$]))?\b(p|page_id|cat|tag)=?(&|$)|&$#',
  '', $redirect['query'] );
 }}}

 That's better, but will replace things like: `tag=page_id` or `tag=tag`.
 It becomes `tag=`.

 Ideally it shouldn't touch anything on the right side of `=` and before
 `&` or `$`.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/8098#comment:14>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list