get_available_post_statuses

The timeline below displays how wordpress function get_available_post_statuses has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.9

/**
 * Returns all the possible statuses for a post type.
 *
 * @since 2.5.0
 *
 * @param string $type The post_type you want the statuses for. Default 'post'.
 * @return string[] An array of all the statuses for the supplied post type.
 */
function get_available_post_statuses($type = 'post')
{
    $stati = wp_count_posts($type);
    return array_keys(get_object_vars($stati));
}

WordPress Version: 5.4

/**
 * Get all the possible statuses for a post_type
 *
 * @since 2.5.0
 *
 * @param string $type The post_type you want the statuses for. Default 'post'.
 * @return string[] An array of all the statuses for the supplied post type.
 */
function get_available_post_statuses($type = 'post')
{
    $stati = wp_count_posts($type);
    return array_keys(get_object_vars($stati));
}

WordPress Version: 3.7

/**
 * Get all the possible statuses for a post_type
 *
 * @since 2.5.0
 *
 * @param string $type The post_type you want the statuses for
 * @return array As array of all the statuses for the supplied post type
 */
function get_available_post_statuses($type = 'post')
{
    $stati = wp_count_posts($type);
    return array_keys(get_object_vars($stati));
}