WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/the author email


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists. See also wp-includes/deprecated.php. Use any of these functions instead.

Description

This tag displays the email address for the author of a post. The E-mail field is set in the user's profile (Administration > Profile > Your Profile). This tag must be used within The Loop.

Note that the address is not encoded or protected in any way from harvesting by spambots. For this, see the Secure From Spammers example.

Replace With

Usage

 <?php the_author_email(); ?> 

Parameters

This tag does not accept any parameters.

Examples

Mailto Link

Displays author email address as a "mailto" link.

<a href="mailto:<?php the_author_email(); ?>">Contact the author</a>

Secure From Spammers

This example partially 'obfuscates' address by using the internal function antispambot() to encode portions in HTML character entities (these are read correctly by your browser). Note the example uses get_the_author_email() function, because the_author_email() echoes the address before antispambot() can act upon it.

<a href="mailto:<?php echo antispambot(get_the_author_email()); ?>">email 
 author</a>

Change Log

Related

the_author(), get_the_author(), the_author_link(), get_the_author_link(), the_author_meta(), get_the_author_meta(), the_author_posts(), get_the_author_posts(), the_author_posts_link(), get_author_posts_url(), get_the_modified_author(), the_modified_author(), wp_dropdown_users(), wp_list_authors()

See also index of Function Reference and index of Template Tags.