Skip to content

Commit

Permalink
fix: fix broken author URL on WP.com (#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurelfulford authored Mar 26, 2020
1 parent 295dbcc commit 9614350
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/blocks/homepage-articles/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,18 @@ function ( $accumulator, $author ) use ( $author_info, &$index ) {
$index ++;
$penultimate = count( $author_info ) - 2;

$get_author_posts_url = get_author_posts_url( $author->ID );
if ( function_exists( 'coauthors_posts_links' ) ) {
$get_author_posts_url = get_author_posts_url( $author->ID, $author->user_nicename );
}

return array_merge(
$accumulator,
[
sprintf(
/* translators: 1: author link. 2: author name. 3. variable seperator (comma, 'and', or empty) */
'<span class="author vcard"><a class="url fn n" href="%1$s">%2$s</a></span>',
esc_url( get_author_posts_url( $author->ID, $author->user_nicename ) ),
esc_url( $get_author_posts_url ),
esc_html( $author->display_name )
),
( $index < $penultimate ) ? ', ' : '',
Expand Down

0 comments on commit 9614350

Please sign in to comment.