[wp-trac] [WordPress Trac] #16092: add_permastruct() should allow more control over WP_Rewrite::generate_rewrite_rules() (was: default parameters used with generate_rewrite_rules for creating rules for extra_permastructs)

WordPress Trac wp-trac at lists.automattic.com
Mon Jan 23 18:23:15 UTC 2012


#16092: add_permastruct() should allow more control over
WP_Rewrite::generate_rewrite_rules()
---------------------------+------------------------------
 Reporter:  dnxpert        |       Owner:  John
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Rewrite Rules  |     Version:  3.0.4
 Severity:  normal         |  Resolution:
 Keywords:  has-patch      |
---------------------------+------------------------------
Changes (by duck_):

 * keywords:  extra permastructs rewrite => has-patch


Comment:

 The attached patch changes the function and class method signatures to:

 {{{
 add_permastruct( $name, $struct, $args = array() )
 }}}

 `$args` mirrors the arguments that can be passed to
 generate_rewrite_rules() as well as the old $with_front parameter.

 The patch changes the structure of WP_Rewrite::$extra_permastructs, but:

  * this is a private property (per the docs)
  * backwards compatibility is maintained in WP_Rewrite::rewrite_rules() --
 this should probably be extended to WP_Rewrite::get_extra_permastruct()
 too.
  * there is a precedent, see [13773]

 I also added some extra documentation. I was considering on also adding
 warnings for the 'paged' and 'walk_dirs' which have to stay true by
 default for back compat, see #19786.

 Related: [13438] / #10912, [13773] / #12605, #19871, #16840

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


More information about the wp-trac mailing list