Function Reference/wp filter object list
Filters a list of objects, based on a set of key => value arguments.
<?php wp_filter_object_list( $list, $args, $operator, $field ); ?>
- (array) (required) An array of objects to filter
- Default: None
- (array) (optional) An array of key => value arguments to match against each object
- Default: array()
- (string) (optional) 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'.
- Default: and
- (boolean|string) (optional) A field from the object to place instead of the entire object
- Default: false
- A list of objects or object fields
Filtering out certain post types from the loop following a search
If multiple post types are returned in a search query you can filter out the posts that are of post type 'page' only.
$pages = wp_filter_object_list( $wp_query->posts, array('post_type' => 'page'));
wp_filter_object_list() is located in