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.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53075 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2022-06-10 18:23:18 +00:00
parent c8f31dc0c0
commit df0d910007
2 changed files with 15 additions and 2 deletions

View File

@ -476,7 +476,20 @@ function wp_list_authors( $args = '' ) {
} }
if ( $args['show_fullname'] && $author->first_name && $author->last_name ) { 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 { } else {
$name = $author->display_name; $name = $author->display_name;
} }

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.1-alpha-53485'; $wp_version = '6.1-alpha-53486';
/** /**
* 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.