On this page
get_post_stati( array|string $args = array(), string $output = 'names', string $operator = 'and' ): string[]|stdClass[]
Gets a list of post statuses.
Description
See also
Parameters
$argsarray|string Optional-
Array or string of post status arguments to compare against properties of the global
$wp_post_statuses objects.Default:
array() $outputstring Optional-
The type of output to return, either
'names'or'objects'. Default'names'.Default:
'names' $operatorstring Optional-
The logical operation to perform.
'or'means only one element from the array needs to match;'and'means all elements must match.
Default'and'.Default:
'and'
Return
string[]|stdClass[] A list of post status names or objects.
Source
File: wp-includes/post.php. View all references
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 );
}
Related
Uses
| Uses | Description |
|---|---|
| wp_filter_object_list() wp-includes/functions.php | Filters a list of objects, based on a set of key => value arguments. |
Used By
| Used By | Description |
|---|---|
| WP_REST_Menu_Items_Controller::get_item_schema() wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Retrieves the term’s schema, conforming to JSON Schema. |
| WP_REST_Templates_Controller::get_item_schema() wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Retrieves the block type’ schema, conforming to JSON Schema. |
| register_and_do_post_meta_boxes() wp-admin/includes/meta-boxes.php | Registers the default post meta boxes, and runs the |
| WP_Privacy_Requests_Table::get_request_counts() wp-admin/includes/class-wp-privacy-requests-table.php | Count number of requests for each status. |
| WP_Customize_Manager::establish_loaded_changeset() wp-includes/class-wp-customize-manager.php | Establishes the loaded changeset. |
| WP_Customize_Manager::import_theme_starter_content() wp-includes/class-wp-customize-manager.php | Imports theme starter content into the customized state. |
| WP_Customize_Manager::find_changeset_post_id() wp-includes/class-wp-customize-manager.php | Finds the changeset post ID for a given changeset UUID. |
| wp_get_custom_css_post() wp-includes/theme.php | Fetches the |
| WP_REST_Post_Statuses_Controller::get_items() wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php | Retrieves all post statuses, depending on user context. |
| WP_REST_Posts_Controller::get_item_schema() wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves the post’s schema, conforming to JSON Schema. |
| WP_REST_Posts_Controller::get_collection_params() wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves the query params for the posts collection. |
| wp_edit_posts_query() wp-admin/includes/post.php | Runs the query to fetch the posts for listing on the edit posts page. |
| 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 | Constructor. |
| WP_Posts_List_Table::prepare_items() wp-admin/includes/class-wp-posts-list-table.php | |
| WP_Query::get_posts() wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| get_adjacent_post() wp-includes/link-template.php | Retrieves the adjacent post. |
| get_page_by_title() wp-includes/post.php | Retrieves a page given its title. |
| get_pages() wp-includes/post.php | Retrieves an array of pages (or hierarchical post type items). |
| wp_insert_post() wp-includes/post.php | Inserts or update a post. |
| wp_count_posts() wp-includes/post.php | Counts number of posts of a post type and if user has permissions to view. |
| redirect_guess_404_permalink() wp-includes/canonical.php | Attempts to guess the correct URL for a 404 request based on query vars. |
Changelog
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_post_stati