WordPress at a glance

get_post_status_object() WP 1.0

Retrieve a post status object by name.

  • Global. Array. $wp_post_statuses List of post statuses.
  • See: register_post_status()
✈ 1 time = 0.000001s = speed of light | 50000 times = 0.11s = very fast | PHP 7.2.5, WP 4.9.8

No Hooks.

Return

Object/null. A post status object.

Usage

get_post_status_object( $post_status );
$post_status(string) (required)
The name of a registered post status.

Code of get post status object: wp-includes/post.php WP 5.2.2

<?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 ];
}

Related Functions

From tag: statuses (of post comment user)

More from category: Other

No comments
    Hello, !     Log In . Register