get_the_author( string $deprecated = '' ): string
- Since
- 1.5.0, 6.3.0
- Source
wp-includes/author-template.php:24
Compatibility
- WordPress
- since 6.3.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Parameters
$deprecatedstringoptional- Deprecated.Default:
''
Return value
string- The author's display name, empty string if unknown.
Performance profile
How much work a call to get_the_author() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Trivial
- Scaling
- Constant
- Instructions
- 12–17
- Plugin surface
- 1 hook
- Called by
- 17
Touches nothing outside its own arguments.
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 18.
Third-party callbacks on 'the_author' run inside this call, and their cost is not bounded by anything here.
17 places in core call this, so the cost is paid more often than your own code shows.
What it touches
- hookthird-party callbacks
apply_filters()called directly
Further down the call graph this can also reach query, option, cache, serialize and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 2 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost get_the_author() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
empty($deprecated) | 12–13 | apply_filters() |
!empty($deprecated) | 16–17 | _deprecated_argument(), apply_filters() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 18 | 12–17 | 2 | |
| 8.5 | 18 | 12–17 | 2 | |
| 8.4 | 18 | 12–17 | 2 | |
| 8.3 | 18 | 12–17 | 2 | |
| 8.2 | 18 | 12–17 | 2 | |
| 8.1 | 18 | 12–17 | 2 | 1 fewer instruction than PHP 7.4 |
| 7.4 | 19 | 12–18 | 2 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Hooks and filters fired · 1
One hook fires while get_the_author() runs, in this order:
- apply_filters( the_author )filterline 38 (+14 into the body)
Filters the display name of the current post's author.
Uses · 2
- _deprecated_argument()Marks a function argument as deprecated and inform when it has been used.
- apply_filters()Calls the callback functions that have been added to a filter hook.
Used by · 17
- Twenty_Fourteen_Ephemera_Widget::widget()Outputs the HTML for this widget.
- WP_Media_List_Table::column_author()Handles the author column output.
- WP_Posts_List_Table::column_author()Handles the post author column output.
- get_the_archive_title()Retrieves the archive title based on the queried object.
- get_the_author_link()Retrieves either author's link or author's name.
- get_the_author_posts_link()Retrieves an HTML link to the author page of the current post's author.
- the_author()Displays the name of the author of the current post.
- twenty_twenty_one_posted_by()Prints HTML with meta information about theme author.
- twentyeleven_posted_on()Prints HTML with meta information for the current post-date/time and author.
- twentyfifteen_entry_meta()Prints HTML with meta information for the categories, tags.
- twentyfourteen_posted_on()Prints HTML with meta information for the current post-date/time and author.
- twentynineteen_posted_by()Prints HTML with meta information about theme author.
Show all 17
- twentyseventeen_posted_on()Prints HTML with meta information for the current post-date/time and author.
- twentysixteen_entry_meta()Prints HTML with meta information for the categories, tags.
- twentyten_posted_on()Prints HTML with meta information for the current post-date/time and author.
- twentythirteen_entry_meta()Prints HTML with meta information for current post: categories, tags, permalink, author, and date.
- twentytwelve_entry_meta()Sets up post entry meta.
Source code
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 : '' );}Changelog
Introduced in 1.5.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.9.7 tag, from
src/wp-includes/author-template.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.