From 8edc944b018ca814619b5efb1d30b5ebfe2a7ef3 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 25 Aug 2011 18:22:17 +0000 Subject: [PATCH] wp_list_pluck() performance improvement. Props Otto42. fixes #18230 git-svn-id: http://svn.automattic.com/wordpress/trunk@18602 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- 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 8897139ea..44962e118 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;