* @return string|null The author's display name, from get_the_author().
*/
function the_author( $deprecated = '', $deprecated_echo = true ) {
- if ( !empty( $deprecated ) )
+ if ( ! empty( $deprecated ) ) {
_deprecated_argument( __FUNCTION__, '2.1' );
- if ( $deprecated_echo !== true )
- _deprecated_argument( __FUNCTION__, '1.5', __('Use <code>get_the_author()</code> instead if you do not want the value echoed.') );
- if ( $deprecated_echo )
+ }
+
+ if ( true !== $deprecated_echo ) {
+ _deprecated_argument( __FUNCTION__, '1.5',
+ /* translators: %s: get_the_author() */
+ sprintf( __( 'Use %s instead if you do not want the value echoed.' ),
+ '<code>get_the_author()</code>'
+ )
+ );
+ }
+
+ if ( $deprecated_echo ) {
echo get_the_author();
+ }
+
return get_the_author();
}
}
/**
- * 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;
*
* @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();
}
/**
*
* @global WP_Rewrite $wp_rewrite
*
+ * @param int $author_id Author ID.
+ * @param string $author_nicename Optional. The author's nicename (slug). Default empty.
* @return string The URL to the author's page.
*/
-function get_author_posts_url($author_id, $author_nicename = '') {
+function get_author_posts_url( $author_id, $author_nicename = '' ) {
global $wp_rewrite;
$auth_ID = (int) $author_id;
$link = $wp_rewrite->get_author_permastruct();
}
/**
- * List all the authors of the blog, with several options available.
+ * List all the authors of the site, with several options available.
*
* @link https://codex.wordpress.org/Template_Tags/wp_list_authors
*
* @since 1.2.0
*
- * @global wpdb $wpdb
+ * @global wpdb $wpdb WordPress database abstraction object.
*
* @param string|array $args {
* Optional. Array or string of default arguments.
*
* @since 3.2.0
*
- * @global wpdb $wpdb
+ * @global wpdb $wpdb WordPress database abstraction object.
*
* @return bool Whether or not we have more than one author
*/