Core Function
View Source on Trac ↗ wp_list_pluck()
wp_list_pluck( mixed $input_list, mixed $field, mixed $index_key = null ) Plucks a certain field out of each object or array in an array.
Parameters 3 required
| Name / Type | Description |
|---|---|
| $input_list array | List of objects or arrays. Required |
| (int | | string) $field Field from the object to place instead of the entire object. Required |
| mixed | (int | string) $index_key Optional. Field from the object to use as keys for the new array. Default null. Required |
Return Value
(array)
array Array of found values. If `$index_key` is set, an array of found values with keys
corresponding to `$index_key`. If `$index_key` is null, array keys from the original
`$input_list` will be preserved in the results.
Function Information
Since Version
3.1.0
Source File
wp-includes/functions.php
Advertisement