get_available_post_statuses() WordPress Function

The get_available_post_statuses() function is used to retrieve a list of available post statuses for the current user. This is useful for determining which statuses are available for use in the post editing screen.

get_available_post_statuses( string $type = 'post' ) #

Returns all the possible statuses for a post type.


Parameters

$type

(string)(Optional)The post_type you want the statuses for.

Default value: 'post'


Top ↑

Return

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


Top ↑

Source

File: wp-admin/includes/post.php

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

	return array_keys( get_object_vars( $stati ) );
}


Top ↑

Changelog

Changelog
VersionDescription
2.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More