Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




wp_list_pluck [ WordPress Function ]

wp_list_pluck ( $list, $field )
Parameters:
  • (array) $list A list of objects or arrays
  • (int|string) $field A field from the object to place instead of the entire object
Returns:
  • (array)
Defined at:



Pluck a certain field out of each object in a list.

Source


<?php
function wp_list_pluck$list$field ) {
    foreach ( 
$list as $key => $value ) {
        if ( 
is_object$value ) )
            
$list$key ] = $value->$field;
        else
            
$list$key ] = $value$field ];
    }

    return 
$list;
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics