get_post_statuses() WordPress Function

The get_post_statuses() function is used to retrieve a list of all the registered post statuses for a given post type.

get_post_statuses() #

Retrieve all of the WordPress supported post statuses.


Description

Posts have a limited set of valid status values, this provides the post_status values and descriptions.


Top ↑

Return

(string[]) Array of post status labels keyed by their status.


Top ↑

More Information

Usage:
$post_statuses = get_post_statuses();

output:

Array
(
[draft] => Draft
[pending] => Pending Review
[private] => Private
[publish] => Published
)

Note:

To get an array of all post statuses, including those created with register_post_type(), see get_post_stati.


Top ↑

Source

File: wp-includes/post.php

function get_post_statuses() {
	$status = array(
		'draft'   => __( 'Draft' ),
		'pending' => __( 'Pending Review' ),
		'private' => __( 'Private' ),
		'publish' => __( 'Published' ),
	);

	return $status;
}


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
Show More