get_available_post_statuses( string $type = ‘post’ ): string[]

In this article

Returns all the possible statuses for a post type.

Parameters

$typestringoptional
The post_type you want the statuses for. Default 'post'.

Default:'post'

Return

string[] An array of all the statuses for the supplied post type.

Source

function get_available_post_statuses( $type = 'post' ) {
	$stati = wp_count_posts( $type );

	return array_keys( get_object_vars( $stati ) );
}

Changelog

VersionDescription
2.5.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.