Make WordPress Core

Ticket #17025: 17025.9.diff

File 17025.9.diff, 858 bytes (added by rafiahmedd, 3 years ago)

As in some countries they make fullname like "last name" + "first name", so I thought a filter hook to modify the fullname of an author could be helpful for the users

  • src/wp-includes/author-template.php

    diff --git a/src/wp-includes/author-template.php b/src/wp-includes/author-template.php
    index e129e6f701..9968a26d61 100644
    a b function wp_list_authors( $args = '' ) { 
    458458                }
    459459
    460460                if ( $args['show_fullname'] && $author->first_name && $author->last_name ) {
    461                         $name = "$author->first_name $author->last_name";
     461
     462                        $full_name = "$author->first_name $author->last_name";
     463
     464                        /**
     465                        * Allows to modify author full name.
     466                        *
     467                        * @since 5.9
     468                        *
     469                        * @param string   $full_name  Full Name of the author default is "$user->first_name $user->last_name"
     470                        * @param object   $author     Author data in object format
     471                        */
     472
     473                        $name = apply_filters( 'wp_list_author_full_name', $full_name, $author);
    462474                } else {
    463475                        $name = $author->display_name;
    464476                }