get_the_author()
Retrieve the author of the current post.
Used By: get_the_author_posts_link(), the_author()
Hooks from the function
Return
String
. The author's display name, empty string if unknown.
Usage
get_the_author( $deprecated );
- $deprecated(string)
- Deprecated.
Default: ''
Examples
#1 Display the display_name (public name) of the author of current post:
$author = get_the_author(); echo $author;
Notes
- Global. WP_User. $authordata The current author's data.
Changelog
Since 1.5.0 | Introduced. |
Since 6.3.0 | Returns an empty string if the author's display name is unknown. |
get_the_author() get the author code WP 6.7.1
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 $display_name The author's display name. */ return apply_filters( 'the_author', is_object( $authordata ) ? $authordata->display_name : '' ); }