get_the_author( string $deprecated = '' ): string|null
Retrieves the author of the current post.
Contents
Parameters
-
$deprecated
string Optional -
Deprecated.
Default:
''
Return
string|null The author's display name.
Source
File: wp-includes/author-template.php
.
View all references
function get_the_author( $deprecated = '' ) {
global $authordata;
if ( ! empty( $deprecated ) ) {
_deprecated_argument( __FUNCTION__, '2.1.0' );
}
/**
* Filters the display name of the current post's author.
*
* @since 2.9.0
*
* @param string|null $display_name The author's display name.
*/
return apply_filters( 'the_author', is_object( $authordata ) ? $authordata->display_name : null );
}
Hooks
-
apply_filters( 'the_author',
string|null $display_name ) -
Filters the display name of the current post’s author.
Changelog
Version | Description |
---|---|
1.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
Grab the Author’s ‘Public’ Name
Grabs the value in the user’s Display name publicly as field.
Top ↑
Feedback
In case you want to get the entire set of data of a single author, use:
https://developer.wordpress.org/reference/functions/get_the_author_meta/ — By Ruurd de Wind —