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
This commit is contained in:
Gary Pendergast 2019-01-16 05:53:26 +00:00
parent 97c6a43eda
commit cd7d022ae0

View File

@ -288,12 +288,12 @@ function the_author_posts() {
* *
* @global object $authordata The current author's DB object. * @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() { function get_the_author_posts_link() {
global $authordata; global $authordata;
if ( ! is_object( $authordata ) ) { if ( ! is_object( $authordata ) ) {
return; return '';
} }
$link = sprintf( $link = sprintf(