If the get_the_excerpt() is called out of bounds of a global $post, return ''.

Fixes #22413.


git-svn-id: https://develop.svn.wordpress.org/trunk@28880 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-06-28 04:00:27 +00:00
parent c2b7f8022c
commit 54d4f34ad2

View File

@ -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.' );