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.


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


git-svn-id: http://core.svn.wordpress.org/trunk@44447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2019-01-16 05:54:49 +00:00
parent 4fa5437fc1
commit 32ace06a39
2 changed files with 3 additions and 3 deletions

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(

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.1-beta1-44615'; $wp_version = '5.1-beta1-44616';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.