From d242d5bbfbf2366170bb15f121493ebe390e6437 Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Tue, 29 Sep 2015 01:49:25 +0000 Subject: [PATCH] Introduce `get_the_author_posts_link()`, which returns the HTML link to the author page for the current post's author. `the_author_posts_link()` has in-turn been converted into a wrapper, with most of its logic moved to the new function. Adds tests for the new function. Props chipbennett, zrothauser, wonderboymusic, DrewAPicture. Fixes #30355. Built from https://develop.svn.wordpress.org/trunk@34677 git-svn-id: http://core.svn.wordpress.org/trunk@34641 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/author-template.php | 33 +++++++++++++++++++++------------ wp-includes/version.php | 2 +- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/wp-includes/author-template.php b/wp-includes/author-template.php index 36d08bc81e..e1571dcc51 100644 --- a/wp-includes/author-template.php +++ b/wp-includes/author-template.php @@ -223,23 +223,17 @@ function the_author_posts() { } /** - * Display an HTML link to the author page of the author of the current post. + * Retrieves an HTML link to the author page of the current post's author. * - * Does just echo get_author_posts_url() function, like the others do. The - * reason for this, is that another function is used to help in printing the - * link to the author's posts. + * Returns an HTML-formatted link using get_author_posts_url(). * - * @link https://codex.wordpress.org/Template_Tags/the_author_posts_link - * @since 1.2.0 + * @since 4.4.0 * * @global object $authordata The current author's DB object. * - * @param string $deprecated Deprecated. + * @return string An HTML link to the author page. */ -function the_author_posts_link($deprecated = '') { - if ( !empty( $deprecated ) ) - _deprecated_argument( __FUNCTION__, '2.1' ); - +function get_the_author_posts_link() { global $authordata; if ( ! is_object( $authordata ) ) { return; @@ -259,7 +253,22 @@ function the_author_posts_link($deprecated = '') { * * @param string $link HTML link. */ - echo apply_filters( 'the_author_posts_link', $link ); + return apply_filters( 'the_author_posts_link', $link ); +} + +/** + * Displays an HTML link to the author page of the current post's author. + * + * @since 1.2.0 + * @since 4.4.0 Converted into a wrapper for get_the_author_posts_link() + * + * @param string $deprecated Unused. + */ +function the_author_posts_link( $deprecated = '' ) { + if ( ! empty( $deprecated ) ) { + _deprecated_argument( __FUNCTION__, '2.1' ); + } + echo get_the_author_posts_link(); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 68ce76a67f..bd376d95c1 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34676'; +$wp_version = '4.4-alpha-34677'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.