WordPress at a glance

get_post_stati() WP 1.0

Get a list of post statuses.

  • Global. Array. $wp_post_statuses List of post statuses.
  • See: register_post_status()
Works based on: wp_filter_object_list()

No Hooks.


Array. A list of post status names or objects.


get_post_stati( $args, $output, $operator );
Array or string of post status arguments to compare against properties of the global $wp_post_statuses objects.
Default: empty array
The type of output to return, either 'names' or 'objects'.
Default: 'names'
The logical operation to perform. 'or' means only one element from the array needs to match; 'and' means all elements must match.
Default: 'and'

Code of get_post_stati: wp-includes/post.php VER 4.9.8

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);

Related Functions

From tag: statuses (of post comment user)

More from category: Other

No comments
    Hello, !     Log In . Register