[wp-trac] [WordPress Trac] #37962: NOT EXISTS tax_query triggers debug notice on get_queried_object()

WordPress Trac noreply at wordpress.org
Tue Sep 6 21:23:11 UTC 2016


#37962: NOT EXISTS tax_query triggers debug notice on get_queried_object()
-----------------------------+---------------------------------------
 Reporter:  johnjamesjacoby  |      Owner:
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Taxonomy         |    Version:  3.8
 Severity:  normal           |   Keywords:  has-patch has-screenshots
  Focuses:                   |
-----------------------------+---------------------------------------
 When querying for post objects without taxonomy terms, a debug notice is
 triggered. (This doesn't happen with the built-in taxonomies, because they
 have old weird special-casing.)

 {{{
 Notice: Undefined index: terms in /srv/www/wordpress-develop/src/wp-
 includes/class-wp-query.php on line 3267
 }}}

 Example code:

 {{{
 add_action( 'admin_init', function() {
         $posts = new WP_Query( array(
                 'post_type' => 'event',
                 'tax_query' => array( array(
                         'taxonomy'         => 'event-category',
                         'operator'         => 'NOT EXISTS',
                         'include_children' => false
                 ) )
         ) );

         var_dump( $posts->get_queried_object() ); die;
 } );
 }}}

 Patch imminent.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37962>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list