Skip to content

Instantly share code, notes, and snippets.

@qwersk
Created June 30, 2017 07:01
Show Gist options
  • Save qwersk/7d120c82ad6bb9fe17f2c158a5532a5c to your computer and use it in GitHub Desktop.
Save qwersk/7d120c82ad6bb9fe17f2c158a5532a5c to your computer and use it in GitHub Desktop.
GET AUTHOR POSTS LINK #WORDPRESS #WP
$args = array(
'orderby' => 'display_name',
'has_published_posts' => true
);
$res = new WP_User_Query($args);
$authors = $res->get_results();
if (!empty($authors))
{
echo '<ul>';
foreach ($authors as $author)
{
$author_info = get_userdata($author->ID);
$author_posts = get_author_posts_url($author->ID);
echo '<li><a href="'.$author_posts.'">'.$author_info->first_name.' '.$author_info->last_name.'</a></li>';
}
echo '</ul>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment