get_available_post_statuses

Get all the possible statuses for a post_type.

Description

(array) get_available_post_statuses( (string) $type = 'post' ); 

Returns (array)

As array of all the statuses for the supplied post type

Parameters (1)

0. $type — Optional. (string) => 'post'
The post_type you want the statuses for

Usage

  1. if ( !function_exists( 'get_available_post_statuses' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/post.php'; 
  3.  
  4. // The post_type you want the statuses for 
  5. $type = 'post'; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = get_available_post_statuses($type); 
  9.  

Defined (1)

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

/wp-admin/includes/post.php  
  1. function get_available_post_statuses($type = 'post') { 
  2. $stati = wp_count_posts($type); 
  3.  
  4. return array_keys(get_object_vars($stati));