get_post_stati() WordPress Function

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

get_post_stati( array|string $args = array(), string $output = 'names', string $operator = 'and' ) #

Get a list of post statuses.


Description

Top ↑

See also


Top ↑

Parameters

$args

(array|string)(Optional) Array or string of post status arguments to compare against properties of the global $wp_post_statuses objects.

Default value: array()

$output

(string)(Optional) The type of output to return, either 'names' or 'objects'.

Default value: 'names'

$operator

(string)(Optional) The logical operation to perform. 'or' means only one element from the array needs to match; 'and' means all elements must match.

Default value: 'and'


Top ↑

Return

(string[]|stdClass[]) A list of post status names or objects.


Top ↑

Source

File: wp-includes/post.php

function get_post_stati( $args = array(), $output = 'names', $operator = 'and' ) {
	global $wp_post_statuses;

	$field = ( 'names' === $output ) ? 'name' : false;

	return wp_filter_object_list( $wp_post_statuses, $args, $operator, $field );
}


Top ↑

Changelog

Changelog
VersionDescription
3.0.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