wp_list_pluck


wp_list_pluck ( $list, $field, $index_key = null )

Parameters:
  • (array) $list List of objects or arrays
  • (int|string) $field Field from the object to place instead of the entire object
  • (int|string) $index_key Optional. Field from the object to use as keys for the new array. Default null.
Returns:
  • (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 `$list` will be preserved in the results.
Defined at:
Change Log:
  • 4: .
  • 4: .

Description

Pluck a certain field out of each object in a list.

This has the same functionality and prototype of array_column() (PHP 5.5) but also supports objects.

Related Functions

wp_list_cats, wp_set_post_lock, wp_list_pages, wp_insert_link, wp_list_filter

Top Google Results

User discussions

wpseek mobile