From 2b4d72c471aa500b92e5ed3d7f49e75457734c7d Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 25 Aug 2011 18:22:17 +0000 Subject: [PATCH] wp_list_pluck() performance improvement. Props Otto42. fixes #18230 git-svn-id: https://develop.svn.wordpress.org/trunk@18602 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/functions.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 8897139eab..44962e118e 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -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;