wp_list_pluck() performance improvement. Props Otto42. fixes #18230
git-svn-id: https://develop.svn.wordpress.org/trunk@18602 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
51f1d1adf0
commit
2b4d72c471
@ -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
Block a user