[wp-trac] [WordPress Trac] #37904: PHP warning when `include` is passed for `orderby` in get_terms()

WordPress Trac noreply at wordpress.org
Thu Sep 1 06:30:59 UTC 2016


#37904: PHP warning when `include` is passed for `orderby` in get_terms()
--------------------------+-----------------------------
 Reporter:  rabmalin      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Steps to reproduce:
 {{{#!php
 <?php
 $args = array(
     'include' => '2,4,3',
     'orderby' => 'include',
     );
 $terms = get_terms( $args );
 }}}

 Output:

 Warning: array_map(): Argument #2 should be an array in
 /var/www/trunk.dev/public_html/wp-includes/class-wp-term-query.php on line
 776

 Warning: implode(): Invalid arguments passed in
 /var/www/trunk.dev/public_html/wp-includes/class-wp-term-query.php on line
 776

 WordPress database error: [You have an error in your SQL syntax; check the
 manual that corresponds to your MySQL server version for the right syntax
 to use near ') ASC' at line 1]
 SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON
 t.term_id = tt.term_id WHERE t.term_id IN ( 2,4,3 ) AND tt.count > 0 ORDER
 BY FIELD( t.term_id, ) ASC


 Environment:
 * WP version: 4.7-alpha-38492

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


More information about the wp-trac mailing list