Switch language
wpseek on Twitter


A WordPress-centric search engine for devs and theme authors




wp_list_pluck ›

wp_list_pluck ( $list, $field )
Parameters: (2)
  • (array) $list A list of objects or arrays
    Required: Yes
    Default:
  • (int|string) $field A field from the object to place instead of the entire object
    Required: Yes
    Default:
Returns:
  • (array)
Defined at:
Codex:



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

Source

function wp_list_pluck( $list, $field ) {
	foreach ( $list as $key => $value ) {
		if ( is_object( $value ) )
			$list[ $key ] = $value->$field;
		else
			$list[ $key ] = $value[ $field ];
	}

	return $list;
}

Top Google Search Results

More ...

User Note(s)