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

Props krogsgard, aaroncampbell.
Fixes #27998.



git-svn-id: https://develop.svn.wordpress.org/trunk@28362 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2014-05-11 00:25:29 +00:00
parent 8998c015b3
commit b70967302b
2 changed files with 13 additions and 2 deletions
+5 -1
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 );
}
/**