get_the_author( string $deprecated = '' ): string

Retrieves the author of the current post.


Parameters

$deprecated string Optional
Deprecated.

Default: ''


Top ↑

Return

string The author's display name, empty string if unknown.


Top ↑

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 $display_name The author's display name.
	 */
	return apply_filters( 'the_author', is_object( $authordata ) ? $authordata->display_name : '' );
}

Top ↑

Hooks



Top ↑

Changelog

Changelog
Version Description
6.3.0 Returns an empty string if the author's display name is unknown.
1.5.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    Contributed by Codex

    Grab the Author’s ‘Public’ Name
    Grabs the value in the user’s Display name publicly as field.

    <?php $author = get_the_author(); ?>

You must log in before being able to contribute a note or feedback.