[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 01:36:52 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 DD32):

 Another option instead of using a Negitive Assertion would be to use a
 word boundary:

 {{{
 $redirect['query'] = preg_replace( '#\b&?(p|page_id|cat|tag)=?$#', '',
 $redirect['query'] );
 }}}

 which achieves the same result (Needs to start with a non-word character),
 I'm not sure which'd be faster, I assume the word boundary would be.

 {{{
 '#(^p|^page_id|^cat|^tag|&p|&page_id|&cat|&tag)=?$#'
 }}}
 Hm, That could work, looks a bit ugly though (but what regex doesnt?)

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


More information about the wp-trac mailing list