[wp-trac] [WordPress Trac] #20929: wp_list_filter Notice

WordPress Trac wp-trac at lists.automattic.com
Tue Jun 12 21:43:21 UTC 2012


#20929: wp_list_filter Notice
--------------------------+------------------------------------
 Reporter:  wpsmith       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Taxonomy      |    Version:
 Severity:  normal        |   Keywords:  has-patch dev-feedback
--------------------------+------------------------------------
 If someone wanted to add an argument for easy filtering on a taxonomy and
 then used get_taxonomies to query that non-standard key, it generates
 notices.

 E.g., Given labels,

 {{{
 $args = array( 'mycustomkey' => true, 'hierarchical' => 0, 'rewrite' =>
 array( 'slug' ), );
 register_taxonomy( 'my_taxonomy', array( 'my_post_type' ), $args);
 }}}


 Then later, if I used:

 {{{
  get_taxonomies( array( 'mycustomkey' => true ) );
 }}}

 it generates:

 {{{
 Notice: Undefined index: mycustomkey in C:\xampp\htdocs\www\sandbox\wp-
 includes\functions.php on line 2499.
 }}}


 This is a simple fix:
 {{{
 if ( isset($to_match[ $m_key ]) && $m_value == $to_match[ $m_key ] )
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20929>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list