[wp-trac] [WordPress Trac] #31112: WP_Query fields=>ids parameter sometimes returns post objects instead of array of post IDs

WordPress Trac noreply at wordpress.org
Fri Jan 23 21:13:21 UTC 2015


#31112: WP_Query fields=>ids parameter sometimes returns post objects instead of
array of post IDs
-------------------------------+------------------------------
 Reporter:  lisota             |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Query              |     Version:  4.1
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------
Changes (by SergeyBiryukov):

 * keywords:   => reporter-feedback


Comment:

 Hi lisota, thanks for the report.

 I could not reproduce this on a clean install. This is the SQL query
 generated by the second snippet:

 {{{
 SELECT SQL_CALC_FOUND_ROWS  trunk_posts.ID FROM trunk_posts  INNER JOIN
 trunk_postmeta ON ( trunk_posts.ID = trunk_postmeta.post_id ) WHERE 1=1
 AND trunk_posts.post_type = 'sponsor_post' AND (trunk_posts.post_status =
 'publish' OR trunk_posts.post_author = 1 AND trunk_posts.post_status =
 'private') AND (
   ( trunk_postmeta.meta_key = 'sponsor_post_type' AND
 CAST(trunk_postmeta.meta_value AS CHAR) != 'advertorial' )
 ) GROUP BY trunk_posts.ID ORDER BY trunk_posts.post_date DESC LIMIT 0, 10
 }}}

 As you can see, it still selects post IDs.

 Does the issue still happen with all plugins disabled and a default theme
 (Twenty Fifteen or Twenty Fourteen) activated?

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


More information about the wp-trac mailing list