get_post_stati() - WordPress 函数参考中文文档

返回介绍

get_post_stati()

发布于 2017-09-10 字数 3239 浏览 1007 评论 0

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

Get a list of post statuses.


描述


参数

$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);
}

更新日志

Version 描述
3.0.0 Introduced.

相关函数

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

上一篇:get_post_reply_link()

下一篇:get_post_status()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!