#27252 closed defect (bug) (fixed)
WP_Query's "fields" => "ids" should return an array of integers
Reported by: | danielbachhuber | Owned by: | wonderboymusic |
---|---|---|---|
Milestone: | 3.9 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Query | Keywords: | has-patch dev-feedback |
Focuses: | Cc: |
Description
When using WP_Query's "fields" => "ids"
(or "fields" => "id=>parent"
), the returned values should be an array of integers, not array of integers represented by strings.
The current, latter behavior causes a subsequent WP_Query with post__in
to fail because it's being passed an array of strings.
Attachments (1)
Change History (6)
This ticket was mentioned in IRC in #wordpress-dev by wonderboymusic. View the logs.
11 years ago
#2
@
11 years ago
I'm all for this but post__in
appears to accept an array of numeric strings fine:
$post__in = implode(',', array_map( 'absint', $q['post__in'] ));
Note: See
TracTickets for help on using
tickets.
Cast returned post IDs as integers