03 Research and Documentation

Author Functions

What is the_author() function in WordPress?

The function the_author() is used to display the name of the author that wrote the post. The name displayed is what is specified in their WordPress profile, and defaults to the username created if a specific other value is not provided. It needs to be used within the WordPress Loop. It echoes the author and prints it but does not return it. If that is desired, the function changes to get_the_author().

What is the_author_link() function in WordPress?

The function the_author_link() displays the website URL of the home page set by the author of the post. The public name of the name of the author is the text used for the URL. It is also included in the WordPress Loop. The home page is often the author’s archive page, which automatically lists all the posts the author has written. Using the_author_link() can provides a way for users to more easier navigate to more information about the author, for example their posts or their personal website.

What are the differences and similarities between the_author() and the_author_link() functions?

What both of these functions have in common is that they will provide the author’s name that wrote the post. They also both need to be included within the WordPress Loop. The biggest difference between them is the_author() will only provide the name of the author, wheres the_author_link() will provide the name of the author, as well as a link to their home page, which can be set up by the author in their user profile, and will default to the author’s archive page.

Summary

In summary, the main purpose of both of these functions is to share the name of the author who wrote the post, and with the_author_link() providing even more information about the author. If a visitor is enjoying reading the post of the author, they may want to read additional posts by that author, or want to learn more about the author. Sharing the name of the author, and especially what page they determine is their home page through these functions help the user navigate to find more information about the author. It also can provide credibility and can enhance SEO.

Sources: