the_author_id

AUTHOR TAG

What It Does

Usually used to link to a query for all the author’s posts, the_author_id displays the numeric user ID of the post’s author. The user ID is assigned in numerical order when an author’s account is created. the_author_id must be used within The Loop.

Code

<?php the_author_ID(); ?>

Example

The following example will display a hyperlink that, when clicked, will perform a search and display all the posts written by the given author:

<p><a href=”index.php?author=<?php the_author_ID(); ?>”>View all
posts by <?php the_author(); ?></a></p>

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

For another example of how you can link to all of the author’s posts, see the_author_posts_link