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
This commit is contained in:
Scott Taylor 2014-06-28 04:01:14 +00:00
parent cf95c6ecc2
commit 13d0a45932
1 changed files with 4 additions and 1 deletions

View File

@ -341,6 +341,9 @@ function get_the_excerpt( $deprecated = '' ) {
_deprecated_argument( __FUNCTION__, '2.3' ); _deprecated_argument( __FUNCTION__, '2.3' );
$post = get_post(); $post = get_post();
if ( empty( $post ) ) {
return '';
}
if ( post_password_required() ) { if ( post_password_required() ) {
return __( 'There is no excerpt because this is a protected post.' ); return __( 'There is no excerpt because this is a protected post.' );