Title: get_post_status_object
Published: April 25, 2014
Last modified: February 24, 2026

---

# get_post_status_object( string $post_status ): stdClass|null

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/get_post_status_object/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/get_post_status_object/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/functions/get_post_status_object/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/get_post_status_object/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_post_status_object/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/get_post_status_object/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_post_status_object/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/get_post_status_object/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/get_post_status_object/?output_format=md#wp--skip-link--target)

Retrieves a post status object by name.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/get_post_status_object/?output_format=md#description)󠁿

### 󠀁[See also](https://developer.wordpress.org/reference/functions/get_post_status_object/?output_format=md#see-also)󠁿

 * [register_post_status()](https://developer.wordpress.org/reference/functions/register_post_status/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/get_post_status_object/?output_format=md#parameters)󠁿

 `$post_status`stringrequired

The name of a registered post status.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_post_status_object/?output_format=md#return)󠁿

 stdClass|null A post status object.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/get_post_status_object/?output_format=md#source)󠁿

    ```php
    function get_post_status_object( $post_status ) {
    	global $wp_post_statuses;

    	if ( ! is_string( $post_status ) || empty( $wp_post_statuses[ $post_status ] ) ) {
    		return null;
    	}

    	return $wp_post_statuses[ $post_status ];
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/post.php#L1513)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/post.php#L1513-L1521)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/get_post_status_object/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_force_plain_post_permalink()](https://developer.wordpress.org/reference/functions/wp_force_plain_post_permalink/)`wp-includes/link-template.php` |

Determine whether post should always use a plain permalink structure.

  | 
| [is_post_status_viewable()](https://developer.wordpress.org/reference/functions/is_post_status_viewable/)`wp-includes/post.php` |

Determines whether a post status is considered “viewable”.

  | 
| [WP_Privacy_Requests_Table::column_status()](https://developer.wordpress.org/reference/classes/wp_privacy_requests_table/column_status/)`wp-admin/includes/class-wp-privacy-requests-table.php` |

Status column.

  | 
| [WP_Privacy_Requests_Table::get_views()](https://developer.wordpress.org/reference/classes/wp_privacy_requests_table/get_views/)`wp-admin/includes/class-wp-privacy-requests-table.php` |

Gets an associative array ( id => link ) with the list of views available on this table.

  | 
| [WP_REST_Post_Statuses_Controller::get_items()](https://developer.wordpress.org/reference/classes/wp_rest_post_statuses_controller/get_items/)`wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php` |

Retrieves all post statuses, depending on user context.

  | 
| [WP_REST_Post_Statuses_Controller::get_item_permissions_check()](https://developer.wordpress.org/reference/classes/wp_rest_post_statuses_controller/get_item_permissions_check/)`wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php` |

Checks if a given request has access to read a post status.

  | 
| [WP_REST_Post_Statuses_Controller::get_item()](https://developer.wordpress.org/reference/classes/wp_rest_post_statuses_controller/get_item/)`wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php` |

Retrieves a specific post status.

  | 
| [WP_REST_Posts_Controller::check_read_permission()](https://developer.wordpress.org/reference/classes/wp_rest_posts_controller/check_read_permission/)`wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php` |

Checks if a post can be read.

  | 
| [WP_REST_Posts_Controller::handle_status_param()](https://developer.wordpress.org/reference/classes/wp_rest_posts_controller/handle_status_param/)`wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php` |

Determines validity and normalizes the given status parameter.

  | 
| [wp_handle_comment_submission()](https://developer.wordpress.org/reference/functions/wp_handle_comment_submission/)`wp-includes/comment.php` |

Handles the submission of a comment, usually posted to wp-comments-post.php via a comment form.

  | 
| [_wp_translate_postdata()](https://developer.wordpress.org/reference/functions/_wp_translate_postdata/)`wp-admin/includes/post.php` |

Renames `$_POST` data from form names to DB post columns.

  | 
| [map_meta_cap()](https://developer.wordpress.org/reference/functions/map_meta_cap/)`wp-includes/capabilities.php` |

Maps a capability to the primitive capabilities required of the given user to satisfy the capability being checked.

  | 
| [WP_Customize_Manager::save()](https://developer.wordpress.org/reference/classes/wp_customize_manager/save/)`wp-includes/class-wp-customize-manager.php` |

Handles customize_save WP Ajax request to save/update a changeset.

  | 
| [WP::parse_request()](https://developer.wordpress.org/reference/classes/wp/parse_request/)`wp-includes/class-wp.php` |

Parses the request to find the correct WordPress query.

  | 
| [WP_Query::get_posts()](https://developer.wordpress.org/reference/classes/wp_query/get_posts/)`wp-includes/class-wp-query.php` |

Retrieves an array of posts based on query variables.

  | 
| [url_to_postid()](https://developer.wordpress.org/reference/functions/url_to_postid/)`wp-includes/rewrite.php` |

Examines a URL and try to determine the post ID it represents.

  | 
| [redirect_canonical()](https://developer.wordpress.org/reference/functions/redirect_canonical/)`wp-includes/canonical.php` |

Redirects incoming links to the proper URL based on the site url.

  | 
| [wp_xmlrpc_server::_insert_post()](https://developer.wordpress.org/reference/classes/wp_xmlrpc_server/_insert_post/)`wp-includes/class-wp-xmlrpc-server.php` |

Helper method for wp_newPost() and wp_editPost(), containing shared logic.

  |

[Show 13 more](https://developer.wordpress.org/reference/functions/get_post_status_object/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/get_post_status_object/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/get_post_status_object/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/get_post_status_object/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 2 content](https://developer.wordpress.org/reference/functions/get_post_status_object/?output_format=md#comment-content-6004)
 2.    [Pixelbart](https://profiles.wordpress.org/pixelbart/)  [  4 years ago  ](https://developer.wordpress.org/reference/functions/get_post_status_object/#comment-6004)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_post_status_object%2F%23comment-6004)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_post_status_object%2F%23comment-6004)
 4.  **Examples**
 5.      ```php
         $obj = get_post_status_object( 'publish' );
         echo esc_html( $obj->label );
         ```
     
 6.  Alternatively, it also works like this:
 7.      ```php
         global $wp_post_statuses;
         $obj = $wp_post_statuses['publish'];
         echo esc_html( $obj->label );
         ```
     
 8.  print_r( $obj ) looks like this:
 9.      ```php
         stdClass Object
         (
             [label] => Published
             [label_count] => Array
                 (
                     [0] => Published (%s)
                     [1] => Published (%s)
                     [singular] => Published (%s)
                     [plural] => Published (%s)
                     [context] => 
                     [domain] => 
                 )
     
             [exclude_from_search] => 
             [_builtin] => 1
             [public] => 1
             [internal] => 
             [protected] => 
             [private] => 
             [publicly_queryable] => 1
             [show_in_admin_status_list] => 1
             [show_in_admin_all_list] => 1
             [date_floating] => 
             [name] => publish
         )
         ```
     
 10.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_post_status_object%2F%3Freplytocom%3D6004%23feedback-editor-6004)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_post_status_object%2F)
before being able to contribute a note or feedback.