From 13d0a4593291af7ccf92ff47c83d6d4e532c0e26 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sat, 28 Jun 2014 04:01:14 +0000 Subject: [PATCH] If the `get_the_excerpt()` is called out of bounds of a global `$post`, return ''. Fixes #22413. Built from https://develop.svn.wordpress.org/trunk@28880 git-svn-id: http://core.svn.wordpress.org/trunk@28679 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post-template.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 0f1570a21b..94fda7dec2 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -27,7 +27,7 @@ function the_ID() { */ function get_the_ID() { $post = get_post(); - return ! empty ( $post ) ? $post->ID : false; + return ! empty( $post ) ? $post->ID : false; } /** @@ -341,6 +341,9 @@ function get_the_excerpt( $deprecated = '' ) { _deprecated_argument( __FUNCTION__, '2.3' ); $post = get_post(); + if ( empty( $post ) ) { + return ''; + } if ( post_password_required() ) { return __( 'There is no excerpt because this is a protected post.' );