the_author_email

AUTHOR TAG

What It Does

Displays the post author’s email address. The email address is defined from within the admin panel at Administration > Profile > Your Profile. the_author_email tag should be used with discretion as your email address will be publicly displayed which may be gathered by emal spambots. the_author_email must be used within The Loop.

Code

<?php the_author_email(); ?>

Example

The following example will display a hyperlink that, when clicked, will open up the user’s email client software addressed to the post’s author:

<p><a href=”mailto:<?php the_author_email(); ?>”>Email the author</a></p>

Of course, the verbage surrounding the_author_email can be changed to whatever you like.

Alternative Usage

To help protect your email address from being harvested by email spambots, WordPress has a rudimentary form of obscuring your email address from being read directly. This is done with a slight modification to the above code as follows:

<a href=”mailto:<?php echo antispambot(get_the_author_email()); ?>”>Email the author</a>