Changeset 51044
- Timestamp:
- 05/28/2021 06:03:06 PM (4 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-list-util.php
r48421 r51044 77 77 /** 78 78 * Filters the list, based on a set of key => value arguments. 79 * 80 * Retrieves the objects from the list that match the given arguments. 81 * Key represents property name, and value represents property value. 82 * 83 * If an object has more properties than those specified in arguments, 84 * that will not disqualify it. When using the 'AND' operator, 85 * any missing properties will disqualify it. 79 86 * 80 87 * @since 4.7.0 -
trunk/src/wp-includes/functions.php
r51041 r51044 4718 4718 * Filters a list of objects, based on a set of key => value arguments. 4719 4719 * 4720 * Retrieves the objects from the list that match the given arguments. 4721 * Key represents property name, and value represents property value. 4722 * 4723 * If an object has more properties than those specified in arguments, 4724 * that will not disqualify it. When using the 'AND' operator, 4725 * any missing properties will disqualify it. 4726 * 4727 * When using the `$field` argument, this function can also retrieve 4728 * a particular field from all matching objects, whereas wp_list_filter() 4729 * only does the filtering. 4730 * 4720 4731 * @since 3.0.0 4721 4732 * @since 4.7.0 Uses `WP_List_Util` class. 4722 4733 * 4723 * @param array $list An array of objects to filter 4734 * @param array $list An array of objects to filter. 4724 4735 * @param array $args Optional. An array of key => value arguments to match 4725 4736 * against each object. Default empty array. 4726 * @param string $operator Optional. The logical operation to perform. ' or' means4727 * only one element from the array needs to match; 'and'4728 * means all elements must match; 'not' means no elements may4729 * match. Default ' and'.4730 * @param bool|string $field A field from the object to place instead of the entire object.4731 * Default false.4737 * @param string $operator Optional. The logical operation to perform. 'AND' means 4738 * all elements from the array must match. 'OR' means only 4739 * one element needs to match. 'NOT' means no elements may 4740 * match. Default 'AND'. 4741 * @param bool|string $field Optional. A field from the object to place instead 4742 * of the entire object. Default false. 4732 4743 * @return array A list of objects or object fields. 4733 4744 */ … … 4750 4761 /** 4751 4762 * Filters a list of objects, based on a set of key => value arguments. 4763 * 4764 * Retrieves the objects from the list that match the given arguments. 4765 * Key represents property name, and value represents property value. 4766 * 4767 * If an object has more properties than those specified in arguments, 4768 * that will not disqualify it. When using the 'AND' operator, 4769 * any missing properties will disqualify it. 4770 * 4771 * If you want to retrieve a particular field from all matching objects, 4772 * use wp_filter_object_list() instead. 4752 4773 * 4753 4774 * @since 3.1.0 … … 4769 4790 4770 4791 $util = new WP_List_Util( $list ); 4792 4771 4793 return $util->filter( $args, $operator ); 4772 4794 } … … 4782 4804 * @since 4.7.0 Uses `WP_List_Util` class. 4783 4805 * 4784 * @param array $list List of objects or arrays 4785 * @param int|string $field Field from the object to place instead of the entire object 4806 * @param array $list List of objects or arrays. 4807 * @param int|string $field Field from the object to place instead of the entire object. 4786 4808 * @param int|string $index_key Optional. Field from the object to use as keys for the new array. 4787 4809 * Default null. … … 4792 4814 function wp_list_pluck( $list, $field, $index_key = null ) { 4793 4815 $util = new WP_List_Util( $list ); 4816 4794 4817 return $util->pluck( $field, $index_key ); 4795 4818 } … … 4814 4837 4815 4838 $util = new WP_List_Util( $list ); 4839 4816 4840 return $util->sort( $orderby, $order, $preserve_keys ); 4817 4841 }
Note: See TracChangeset
for help on using the changeset viewer.