wp_list_pluck() performance improvement. Props Otto42. fixes #18230
git-svn-id: http://svn.automattic.com/wordpress/trunk@18602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c7e870877c
commit
8edc944b01
|
@ -3220,8 +3220,10 @@ function wp_list_filter( $list, $args = array(), $operator = 'AND' ) {
|
|||
*/
|
||||
function wp_list_pluck( $list, $field ) {
|
||||
foreach ( $list as $key => $value ) {
|
||||
$value = (array) $value;
|
||||
$list[ $key ] = $value[ $field ];
|
||||
if ( is_object( $value ) )
|
||||
$list[ $key ] = $value->$field;
|
||||
else
|
||||
$list[ $key ] = $value[ $field ];
|
||||
}
|
||||
|
||||
return $list;
|
||||
|
|
Loading…
Reference in New Issue