返回介绍

get_post_stati()

发布于 2017-09-10 23:55:50 字数 3237 浏览 1112 评论 0 收藏 0

get_post_stati( array|string $args = array(),  string $output = 'names',  string $operator = 'and' )

Get a list of post statuses.


description


参数

$args

(array|string) (Optional) Array or string of post status arguments to compare against properties of the global $wp_post_statuses objects.

Default value: array()

$output

(string) (Optional) The type of output to return, either 'names' or 'objects'.

Default value: 'names'

$operator

(string) (Optional) The logical operation to perform. 'or' means only one element from the array needs to match; 'and' means all elements must match.

Default value: 'and'


返回值

(array) A list of post status names or objects.


源代码

File: wp-includes/post.php

function get_post_stati( $args = array(), $output = 'names', $operator = 'and' ) {
	global $wp_post_statuses;

	$field = ('names' == $output) ? 'name' : false;

	return wp_filter_object_list($wp_post_statuses, $args, $operator, $field);
}

更新日志

Versiondescription
3.0.0Introduced.

相关函数

Uses

  • wp-includes/functions.php: wp_filter_object_list()

Used By

  • wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::import_theme_starter_content()
  • wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::find_changeset_post_id()
  • wp-includes/theme.php: wp_get_custom_css_post()
  • wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php: WP_REST_Post_Statuses_Controller::get_items()
  • 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-admin/includes/post.php: wp_edit_posts_query()
  • wp-admin/includes/class-wp-posts-list-table.php: WP_Posts_List_Table::get_views()
  • wp-admin/includes/class-wp-posts-list-table.php: WP_Posts_List_Table::__construct()
  • wp-admin/includes/class-wp-posts-list-table.php: WP_Posts_List_Table::prepare_items()
  • wp-includes/class-wp-query.php: WP_Query::get_posts()
  • wp-includes/link-template.php: get_adjacent_post()
  • wp-includes/post.php: get_pages()
  • wp-includes/post.php: wp_count_posts()
  • Show 9 more used by Hide more used by

User Contributed Notes

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

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

发布评论

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