[wp-trac] [WordPress Trac] #43787: sql error in wp_get_post_terms

WordPress Trac noreply at wordpress.org
Tue Apr 17 11:07:58 UTC 2018


#43787: sql error in wp_get_post_terms
--------------------------+-----------------------------
 Reporter:  d1sabled      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 hi guys,

 i create new plugin, and when i try to fetch all custom taxonomies of the
 post, i give an error :

 my code:

 {{{
  [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 'FROM
 wp_terms AS t  INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id
 ' at line 1]

 SELECT   FROM wp_terms AS t  INNER JOIN wp_term_taxonomy AS tt ON
 t.term_id = tt.term_id INNER JOIN wp_term_relationships AS tr ON
 tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN
 ('olympic_games_tax') AND tr.object_id IN (15950) ORDER BY t.name ASC
 }}}

 {{{#!php
 <?php
 $term_list = wp_get_post_terms(get_the_ID(), 'olympic_games_tax',
 array("fields" => "slug"));
 }}}

 Have a nice day.

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


More information about the wp-trac mailing list