Definition:
function wp_filter_object_list( $list, $args = array() {}
Filters a list of objects, based on a set of key => value arguments.
Parameters
- array $list: An array of objects to filter
- array $args: An array of key => value arguments to match against each object
- string $operator: The logical operation to perform. ‘or’ means only one element from the array needs to match; ‘and’ means all elements must match. The default is ‘and’.
- bool|string $field: A field from the object to place instead of the entire object
Return values
returns:A list of objects or object fields
Source code
function wp_filter_object_list( $list, $args = array(), $operator = 'and', $field = false ) {
if ( ! is_array( $list ) )
return array();
$list = wp_list_filter( $list, $args, $operator );
if ( $field )
$list = wp_list_pluck( $list, $field );
return $list;
}
3659

February 12, 2011 


No comments yet... Be the first to leave a reply!