WordPress at a glance

get_the_author_link() WP 1.0

Retrieve either author's link or author's name.

If the author has a home page set, return an HTML link, otherwise just return the author's name.

Is the basis for: the_author_link()

No Hooks.

Return

String/null. An HTML link if the author's url exist in user meta, else the result of get_the_author().

Usage

get_the_author_link();

Code of get_the_author_link: wp-includes/author-template.php VER 5.0.1

<?php
function get_the_author_link() {
	if ( get_the_author_meta('url') ) {
		return sprintf( '<a href="%1$s" title="%2$s" rel="author external">%3$s</a>',
			esc_url( get_the_author_meta('url') ),
			/* translators: %s: author's display name */
			esc_attr( sprintf( __( 'Visit %s&#8217;s website' ), get_the_author() ) ),
			get_the_author()
		);
	} else {
		return get_the_author();
	}
}

Related Functions

From tag: WP Loop

More from category: Other

More from Template Tags: Authors

No comments
    Hello, !     Log In . Register