WordPress at a glance

wp_list_filter() WP 1.0

Filters a list of objects, based on a set of key => value arguments.

  • Since 4.7.0 Uses WP_List_Util class.
Works based on: WP_List_Util()

No Hooks.

Return

Array. Array of found values.

Usage

wp_list_filter( $list, $args, $operator );
$list(array) (required)
An array of objects to filter.
$args(array)
An array of key => value arguments to match against each object.
Default: empty array
$operator(string)
The logical operation to perform. 'AND' means all elements from the array must match. 'OR' means only one element needs to match. 'NOT' means no elements may match.
Default: 'AND'

Code of wp_list_filter: wp-includes/functions.php VER 4.9.8

<?php
function wp_list_filter( $list, $args = array(), $operator = 'AND' ) {
	if ( ! is_array( $list ) ) {
		return array();
	}

	$util = new WP_List_Util( $list );
	return $util->filter( $args, $operator );
}

Related Functions

From tag: array list help functions (sorting arrays objects)

More from category: Helper Functions

No comments
    Hello, !     Log In . Register