diff -r c7c34916027a -r 177826044cd9 wp/wp-includes/class-wp-list-util.php --- a/wp/wp-includes/class-wp-list-util.php Mon Oct 14 18:06:33 2019 +0200 +++ b/wp/wp-includes/class-wp-list-util.php Mon Oct 14 18:28:13 2019 +0200 @@ -97,7 +97,7 @@ return array(); } - $count = count( $args ); + $count = count( $args ); $filtered = array(); foreach ( $this->output as $key => $obj ) { @@ -115,7 +115,7 @@ ( 'OR' == $operator && $matched > 0 ) || ( 'NOT' == $operator && 0 == $matched ) ) { - $filtered[$key] = $obj; + $filtered[ $key ] = $obj; } } @@ -140,6 +140,8 @@ * `$list` will be preserved in the results. */ public function pluck( $field, $index_key = null ) { + $newlist = array(); + if ( ! $index_key ) { /* * This is simple. Could at some point wrap array_column() @@ -147,11 +149,14 @@ */ foreach ( $this->output as $key => $value ) { if ( is_object( $value ) ) { - $this->output[ $key ] = $value->$field; + $newlist[ $key ] = $value->$field; } else { - $this->output[ $key ] = $value[ $field ]; + $newlist[ $key ] = $value[ $field ]; } } + + $this->output = $newlist; + return $this->output; } @@ -159,7 +164,6 @@ * When index_key is not set for a particular item, push the value * to the end of the stack. This is how array_column() behaves. */ - $newlist = array(); foreach ( $this->output as $value ) { if ( is_object( $value ) ) { if ( isset( $value->$index_key ) ) {