get_post_status_object
Retrieve a post status object by name.
Description
(object|null) get_post_status_object( (string) $post_status );
Returns (object|null)
A post status object.
Parameters (1)
- 0. $post_status (string)
- The name of a registered post status.
Usage
if ( !function_exists( 'get_post_status_object' ) ) { require_once ABSPATH . WPINC . '/post.php'; } // The name of a registered post status. $post_status = ''; // NOTICE! Understand what this does before running. $result = get_post_status_object($post_status);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/post.php
- function get_post_status_object( $post_status ) {
- global $wp_post_statuses;
- if ( empty($wp_post_statuses[$post_status]) )
- return null;
- return $wp_post_statuses[$post_status];
- }