返回介绍

wp_list_filter()

发布于 2017-09-11 12:22:00 字数 3119 浏览 1034 评论 0 收藏 0

wp_list_filter( array $list,  array $args = array(),  string $operator = 'AND' )

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


description


参数

$list

(array) (Required) An array of objects to filter.

$args

(array) (Optional) An array of key => value arguments to match against each object.

Default value: array()

$operator

(string) (Optional) 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 value: 'AND'


返回值

(array) Array of found values.


源代码

File: wp-includes/functions.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 );
}

更新日志

Versiondescription
4.7.0Uses WP_List_Util class.
3.1.0Introduced.

相关函数

Uses

  • wp-includes/class-wp-list-util.php: WP_List_Util::__construct()

Used By

  • wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php: WP_REST_Posts_Controller::get_item_schema()
  • wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php: WP_REST_Posts_Controller::get_collection_params()
  • wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php: WP_REST_Posts_Controller::prepare_item_for_response()
  • wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php: WP_REST_Posts_Controller::handle_terms()
  • wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php: WP_REST_Posts_Controller::check_assign_terms_permission()
  • wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php: WP_REST_Posts_Controller::get_items()
  • wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php: WP_REST_Post_Types_Controller::prepare_item_for_response()
  • wp-includes/rest-api/class-wp-rest-response.php: WP_REST_Response::remove_link()
  • wp-admin/includes/class-wp-automatic-updater.php: WP_Automatic_Updater::send_debug_email()
  • wp-admin/includes/ms.php: _access_denied_splash()
  • Show 5 more used by Hide more used by

User Contributed Notes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文