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
This commit is contained in:
Jb Audras 2022-06-10 18:21:28 +00:00
parent b855e63693
commit 7e0bb191fb

View File

@ -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;
}