diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php index a091853d1c..dfd80f46e6 100644 --- a/src/wp-includes/link-template.php +++ b/src/wp-includes/link-template.php @@ -259,7 +259,7 @@ function get_post_permalink( $id = 0, $leavename = false, $sample = false ) { $slug = $post->post_name; - $draft_or_pending = isset( $post->post_status ) && in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft', 'future' ) ); + $draft_or_pending = get_post_status( $id ) && in_array( get_post_status( $id ), array( 'draft', 'pending', 'auto-draft', 'future' ) ); $post_type = get_post_type_object($post->post_type); diff --git a/src/wp-includes/post-functions.php b/src/wp-includes/post-functions.php index e8ac9645cc..d1cdc6927e 100644 --- a/src/wp-includes/post-functions.php +++ b/src/wp-includes/post-functions.php @@ -573,7 +573,14 @@ function get_post_status( $ID = '' ) { } - return $post->post_status; + /** + * Filters the post status. + * + * @since 4.4.0 + * + * @param string $post->post_status The status of the post. + */ + return apply_filters( 'get_post_status', $post->post_status, $post ); } /**