get_post_stati

Get a list of post statuses.

Description

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

Returns (array)

A list of post status names or objects.

Parameters (3)

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

Usage

  1. if ( !function_exists( 'get_post_stati' ) ) { 
  2. require_once ABSPATH . WPINC . '/post.php'; 
  3.  
  4. // Optional. Array or string of post status arguments to compare against 
  5. // properties of the global `$wp_post_statuses objects`. Default empty array. 
  6. $args = array(); 
  7.  
  8. // Optional. The type of output to return, either 'names' or 'objects'. Default 'names'. 
  9. $output = 'names'; 
  10. $operator = 'and'; 
  11.  
  12. // NOTICE! Understand what this does before running. 
  13. $result = get_post_stati($args, $output, $operator); 
  14.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/post.php  
  1. function get_post_stati( $args = array(), $output = 'names', $operator = 'and' ) { 
  2. global $wp_post_statuses; 
  3.  
  4. $field = ('names' == $output) ? 'name' : false; 
  5.  
  6. return wp_filter_object_list($wp_post_statuses, $args, $operator, $field);