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

WordPress Trac wp-trac at lists.automattic.com
Sat Nov 8 12:57:08 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 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'] );}}}

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


More information about the wp-trac mailing list