From 84286aa38553c7331e6d3abf3a85966f2d29e5b7 Mon Sep 17 00:00:00 2001 From: Sainath Poojary Date: Wed, 3 Jun 2026 15:45:35 +0530 Subject: [PATCH] Post Types: make get_post_statuses() and get_page_statuses() use registered post stati instead of hardcoded values. --- src/wp-includes/post.php | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php index 005ccadd62e34..46bd16a09d5ea 100644 --- a/src/wp-includes/post.php +++ b/src/wp-includes/post.php @@ -1320,14 +1320,14 @@ function get_post_status( $post = null ) { * @return string[] Array of post status labels keyed by their status. */ function get_post_statuses() { - $status = array( - 'draft' => __( 'Draft' ), - 'pending' => __( 'Pending Review' ), - 'private' => __( 'Private' ), - 'publish' => __( 'Published' ), - ); + $statuses = get_post_stati( array( 'internal' => true ), 'objects', 'NOT' ); + + $stati = array(); + foreach ( $statuses as $name => $status ) { + $stati[ $name ] = $status->label; + } - return $status; + return $stati; } /** @@ -1341,13 +1341,14 @@ function get_post_statuses() { * @return string[] Array of page status labels keyed by their status. */ function get_page_statuses() { - $status = array( - 'draft' => __( 'Draft' ), - 'private' => __( 'Private' ), - 'publish' => __( 'Published' ), - ); + $statuses = get_post_stati( array( 'internal' => true ), 'objects', 'NOT' ); + + $stati = array(); + foreach ( $statuses as $name => $status ) { + $stati[ $name ] = $status->label; + } - return $status; + return $stati; } /**