From cd7d022ae095e24121b1e83ca536cfce17fc6547 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Wed, 16 Jan 2019 05:53:26 +0000 Subject: [PATCH] Templates: Fix the return value of `get_the_author_posts_link()`. When the `$authordata` global isn't defined, return an empty string, rather than `void`. Props mukesh27, subrataemfluence. Fixes #45597. git-svn-id: https://develop.svn.wordpress.org/trunk@44616 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/author-template.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/author-template.php b/src/wp-includes/author-template.php index b73d84dadc..210ed68137 100644 --- a/src/wp-includes/author-template.php +++ b/src/wp-includes/author-template.php @@ -288,12 +288,12 @@ function the_author_posts() { * * @global object $authordata The current author's DB object. * - * @return string An HTML link to the author page. + * @return string An HTML link to the author page, or an empty string if $authordata isn't defined. */ function get_the_author_posts_link() { global $authordata; if ( ! is_object( $authordata ) ) { - return; + return ''; } $link = sprintf(