In get_the_author_posts(), if there is no current $post, return 0 and bail.

Props krogsgard, aaroncampbell.
Fixes #27998.


Built from https://develop.svn.wordpress.org/trunk@28362


git-svn-id: http://core.svn.wordpress.org/trunk@28190 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-05-11 00:26:14 +00:00
parent d06c353995
commit 5df38694e9

View File

@ -206,7 +206,11 @@ function the_author_link() {
* @return int The number of posts by the author.
*/
function get_the_author_posts() {
return count_user_posts( get_post()->post_author );
$post = get_post();
if ( ! $post ) {
return 0;
}
return count_user_posts( $post->post_author );
}
/**