From 7e0bb191fbcdbd3c32a51715fda80d22cfaeef8e Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Fri, 10 Jun 2022 18:21:28 +0000 Subject: [PATCH] Query: Add a hook to filter author full name from `wp_list_authors()`. This changeset introduces the `wp_list_author_full_name` hook to allows developers to filter author full name, which by default is a combinaison of the author first and last name, separated by a space. Props kevinB, wonderboymusic, DrewAPicture, nacin, Mte90, jorbin, afercia, rafiahmedd. Fixes #17025. git-svn-id: https://develop.svn.wordpress.org/trunk@53486 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/author-template.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/author-template.php b/src/wp-includes/author-template.php index 5a119b4ccc..c71ef7134f 100644 --- a/src/wp-includes/author-template.php +++ b/src/wp-includes/author-template.php @@ -476,7 +476,20 @@ function wp_list_authors( $args = '' ) { } if ( $args['show_fullname'] && $author->first_name && $author->last_name ) { - $name = "$author->first_name $author->last_name"; + + $full_name = $author->first_name . ' ' . $author->last_name; + + /** + * Filters the author's full name. + * + * @since 6.1.0 + * + * @param string $full_name Full Name of the author. Default: The author's first name + * and last name, separated by a space. + * @param object $author Author object. + */ + $name = apply_filters( 'wp_list_author_full_name', $full_name, $author ); + } else { $name = $author->display_name; }