Make WordPress Core

Ticket #39844: 39844.diff

File 39844.diff, 1.4 KB (added by sabernhardt, 3 years ago)
  • src/wp-includes/author-template.php

     
    289289 *
    290290 * @global WP_User $authordata The current author's data.
    291291 *
    292  * @return string An HTML link to the author page, or an empty string if $authordata isn't defined.
     292 * @return string An HTML link to the author page, or just the author's name if the URL is empty, or an empty string if $authordata is not defined.
    293293 */
    294294function get_the_author_posts_link() {
    295295        global $authordata;
     
    297297                return '';
    298298        }
    299299
    300         $link = sprintf(
    301                 '<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
    302                 esc_url( get_author_posts_url( $authordata->ID, $authordata->user_nicename ) ),
    303                 /* translators: %s: Author's display name. */
    304                 esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ),
    305                 get_the_author()
    306         );
     300        $url = get_author_posts_url( $authordata->ID, $authordata->user_nicename );
     301        if ( empty( $url ) || 'http://' === $url ) {
     302                $link = get_the_author();
     303        } else {
     304                $link = sprintf(
     305                        '<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
     306                        esc_url( $url ),
     307                        /* translators: %s: Author's display name. */
     308                        esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ),
     309                        get_the_author()
     310                );
     311        }
    307312
    308313        /**
    309314         * Filters the link to the author page of the author of the current post.