'wordpress plugin - first author shown twice
I'm trying to set up a wordpress plugin in order to show articles authors in wordpress
function inl_users() {
if ( function_exists( 'get_coauthors' ) ) {
$coauthors = get_coauthors();
//array_shift($coauthors);
foreach ( $coauthors as $coauthor ) {
$autArray[] = '<a href=' . get_author_posts_url( $coauthor->ID ) . '>' . $coauthor->display_name . '</a>';
echo implode(", ", $autArray);
}
}
The first author is shown twice in the first element, like this:
for $autArray = (John Smith, Joe Blogs); it returns
John SmithJohn Smith, Joe Blogs
html is like this:<a href="https://example.com/author/john-smith/">John Smith</a><a href="https://example.com/author/john-smith/">John Smith</a>, <a href="https://example.com/author/joe-blogs/">Joe Blogs</a>
as you can see I've tried to use array_shift() because I thought they were two distinct elements, but they are not
any suggestions?
thanks in advance
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
