get_post_status_object( string $post_status )

Retrieve a post status object by name.

Description

See also

Parameters

$post_status

(string) (Required) The name of a registered post status.

Return

(object|null) A post status object.

Source

File: 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 ];
}

Changelog

Version Description
3.0.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_post_status_object