[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:26:56 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:
-------------------------------+------------------------------

Comment (by lisota):

 The SQL generated on mine was the same


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

 The problem was in the value returned. (WP_Query Object versus an array of
 post IDs) Let me try this same query in a staging environment and see if
 that makes a difference.

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


More information about the wp-trac mailing list