[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
Sat Jan 24 08:44:37 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):
OK. I figured this out. I wasn't paying enough attention to the query
results, and some var_dumps helped me out. I was expecting the return to
be an array of post IDs, and nothing else, based on the verbiage in the
codex. There is an array of post IDs, but you have to get to it from the
query object with $query->posts. Kind of a stupid mistake on my part.
I did find that the post IDs are strings and are not being cast to
integers, which is odd since
[https://core.trac.wordpress.org/ticket/27252] was supposed to fix it.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31112#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list