[wp-trac] [WordPress Trac] #16840: add_rewrite_rule() should accept an array for the $redirect parameter
    WordPress Trac 
    wp-trac at lists.automattic.com
       
    Sat Mar 12 23:33:27 UTC 2011
    
    
  
#16840: add_rewrite_rule() should accept an array for the $redirect parameter
---------------------------+-----------------------------
 Reporter:  scribu         |      Owner:
     Type:  enhancement    |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Rewrite Rules  |    Version:
 Severity:  normal         |   Keywords:  has-patch
---------------------------+-----------------------------
 The most common usage of {{{add_rewrite_rule()}}} looks something like
 this:
 {{{
 add_rewrite_rule( 'some/path/([^/]+)/?$',
 'index.php?some_var=$matches[1]&maybe_some_flag=1' );
 }}}
 That's not very pretty.
 Here's what it could look like instead:
 {{{
 add_rewrite_rule( 'some/path/([^/]+)/?$', array(
   'some_var' => '$matches[1]',
   'maybe_some_flag' => 1
 ) );
 }}}
 In the rare case when you want to use something other than 'index.php' in
 the front (i.e. an external rule), you can either fall back to the old
 form or just use add_external_rule().
-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16840>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
    
    
More information about the wp-trac
mailing list