Opened 7 months ago
Last modified 2 months ago
#22208 new enhancement
get_children() doesn't support 'fields' => 'ids' as an argument
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Query | Version: | 3.4.2 |
| Severity: | normal | Keywords: | dev-feedback has-patch |
| Cc: |
Description
Not sure whether it should, but it would be nice.
When you pass 'fields' => 'ids' as an argument, the data returned by get_posts() is nooped with this block:
foreach ( $children as $key => $child )
$kids[$child->ID] = $children[$key];
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.

I've added a patch that checks whether the fields parameter is set to either ids or id=>parent, in which case it returns the result from get_posts. Please note that if this is the case, the $output parameter will have no effect. This is something to consider, as it does make the functionality a bit confusing.
Another option would be to ignore the fields parameter for this function and add documentation for that, but it does break functionality currently.