mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user