the_author

Display the name of the author of the current post.

Description

(string|null) the_author( (string) $deprecated = '', (bool) $deprecated_echo = true ); 

The behavior of this function is based off of old functionality predating get_the_author(). This function is not deprecated, but is designed to echo the value from get_the_author() and as an result of any old theme that might still use the old behavior will also pass the value from get_the_author().

The normal, expected behavior of this function is to echo the author and not return it. However, backward compatibility has to be maintained.

Returns (string|null)

The author's display name, from get_the_author().

Parameters (2)

0. $deprecated — Optional. (string) => ''
The deprecated.
1. $deprecated_echo — Optional. (bool) => true
Deprecated. Use get_the_author(). Echo the string or return it.

Usage

  1. if ( !function_exists( 'the_author' ) ) { 
  2. require_once ABSPATH . WPINC . '/author-template.php'; 
  3.  
  4. // The deprecated. 
  5. $deprecated = ''; 
  6.  
  7. // Deprecated. Use get_the_author(). Echo the string or return it. 
  8. $deprecated_echo = true; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = the_author($deprecated, $deprecated_echo); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/author-template.php  
  1. function the_author( $deprecated = '', $deprecated_echo = true ) { 
  2. if ( ! empty( $deprecated ) ) { 
  3. _deprecated_argument( __FUNCTION__, '2.1.0' ); 
  4.  
  5. if ( true !== $deprecated_echo ) { 
  6. _deprecated_argument( __FUNCTION__, '1.5.0',  
  7. /** translators: %s: get_the_author() */ 
  8. sprintf( __( 'Use %s instead if you do not want the value echoed.' ),  
  9. '<code>get_the_author()</code>' 
  10. ); 
  11.  
  12. if ( $deprecated_echo ) { 
  13. echo get_the_author(); 
  14.  
  15. return get_the_author();