Switch language
wpseek on Twitter


A WordPress-centric search engine for devs and theme authors




wp_list_pluck [ ]

wp_list_pluck ( $list, $field )
Parameters:
  • (array) $list A list of objects or arrays
  • (int|string) $field A field from the object to place instead of the entire object
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

User Note(s)