[wp-trac] [WordPress Trac] #23668: Check for empty slug input in register_taxonomy

WordPress Trac noreply at wordpress.org
Thu Sep 12 00:53:57 UTC 2013


#23668: Check for empty slug input in register_taxonomy
--------------------------+-----------------------------
 Reporter:  cliffseal     |       Owner:  wonderboymusic
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  3.7
Component:  Taxonomy      |     Version:  3.5.1
 Severity:  normal        |  Resolution:  fixed
 Keywords:  needs-patch   |
--------------------------+-----------------------------

Comment (by dd32):

 > [25351]

 I do have to mention, that if someone had their register_taxonomy call
 with
 {{{
 array(
  'rewrite' => 'with_front=0&slug=something', // or slug=something, etc.
  ...
 )
 }}}

 That code will now be broken, which was what nacin was alluding to in
 comment:18, and jond3r in comment:19 appears to be using.

 An alternative to this would've been either
 {{{
 if ( is_array( $args['rewrite'] ) && empty( $args['rewrite']['slug'] ) )
    unset( $args['rewrite']['slug'] );
 }}}
 or
 {{{
 $default_slug = sanitize_title_with_dashes( $taxonomy );
 wp_parse_args(.. $default_slug..)
 if ( empty( $args['rewrite']['slug'] ) )
    $args['rewrite']['slug'] = $default_slug;
 }}}

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


More information about the wp-trac mailing list