[wp-trac] [WordPress Trac] #47614: The meta_query of wp_query only support type of 'post'.

WordPress Trac noreply at wordpress.org
Thu Jun 27 06:05:55 UTC 2019


#47614: The meta_query of wp_query only support type of 'post'.
-------------------------------------+------------------------------
 Reporter:  issaczhuang              |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Query                    |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  close reporter-feedback  |     Focuses:
-------------------------------------+------------------------------
Changes (by knutsp):

 * keywords:   => close reporter-feedback
 * version:  5.2.2 =>


Comment:

 Hello @issaczhuang, welcome to Trac and thanks for reporting an issue.

 It's hard to say why you can't get your meta query to work with so little
 information, if that is the situation.

 To say that meta queries only work for post type "post" is not correct.
 Sites and developers depend on that all he time.

 In the line you are quoting, parameter 1 for the `get_sql`method is the
 **object** type, not the post type. Object types are "post", "user",
 "term", "comment" and such that have a meta table in the database.
 `$wpdb->posts` is the main table for all post types.

 Unless you have further information indicating a bug in WordPress Core, I
 have to recommend this ticket closed as invalid. If you need help getting
 your queries to run, please post in our support forums
 [https://wordpress.org/support/forums/].

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47614#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list