All the information about author of the post being displayed or current post in the WordPress loop is stored in this global variable. It is set in the function setup_postdata($post) defined in [wordpress root folder]/wp-includes/functions.php. setup_postdata($post) is invoked in the WordPress loop on the current post.

WordPress provides a set of functions to retrieve the author information. This global variable need not be directly accessed by the plugin or theme developers.

In the list below, all the get_the_author_* functions have the_author_* counterparts. The get_the_author_* functions return the value whereas the_author_* functions display (echo) it.

The functions are:

  • get_the_author() returns the author’s display name.
  • get_the_author_description() returns the author’s profile.
  • get_the_author_login() returns the author’s username.
  • get_the_author_firstname() returns the author’s first name.
  • get_the_author_lastname() returns the author’s last name.
  • get_the_author_nickname() returns the author’s nickname.
  • get_the_author_ID() returns the author’s login ID.
  • get_the_author_email() returns the author’s email address.
  • get_the_author_url() returns URL of the author’s website.
  • get_the_author_icq() returns the author’s ICQ ID.
  • get_the_author_aim() returns the author’s AIM ID.
  • get_the_author_yim() returns the author’s Yahoo! Messenger ID.
  • get_the_author_msn() returns the author’s MSN Messenger ID.
  • get_the_author_posts() returns the author’s posts.
  • the_author_posts_link() displays link to all posts by the author.

In addition to this there are some more functions that can be used to retrieve details of specified author, they work even outside the WordPress loop.

  • get_author_link($echo = false, $author_id, $author_nicename) return link to all posts by the author.
  • wp_list_authors($args = '') lists links to all the authors, every link leading to all posts by an author. The arguments it takes are
    • option_count: true/false
    • exclude_admin: true/false
    • show_fullname: true/false
    • hide_empty: true/false
    • feed: feed name
    • feed_image: path to feed image

Back to full list of global variables.

Technorati tags: , , , ,


2 Responses to “authordata”

  1. Sein » authordata Says:

    […] Back to full list of global variables. via […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: