Make WordPress Core

Changeset 53486


Ignore:
Timestamp:
06/10/2022 06:21:28 PM (22 months ago)
Author:
audrasjb
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/author-template.php

    r53189 r53486  
    477477
    478478        if ( $args['show_fullname'] && $author->first_name && $author->last_name ) {
    479             $name = "$author->first_name $author->last_name";
     479
     480            $full_name = $author->first_name . ' ' . $author->last_name;
     481
     482            /**
     483             * Filters the author's full name.
     484             *
     485             * @since 6.1.0
     486             *
     487             * @param string $full_name Full Name of the author. Default: The author's first name
     488             *                          and last name, separated by a space.
     489             * @param object $author    Author object.
     490             */
     491             $name = apply_filters( 'wp_list_author_full_name', $full_name, $author );
     492
    480493        } else {
    481494            $name = $author->display_name;
Note: See TracChangeset for help on using the changeset viewer.