WordPress.org

Make WordPress Core

Opened 16 months ago

Last modified 12 months ago

#39844 new enhancement

Don't return anchor tag if link is empty in get_the_author_posts_link()

Reported by: SirkoSchindler Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.7.2
Component: Themes Keywords: has-patch needs-unit-tests
Focuses: template Cc:

Description

If get_author_posts_url() returns an empty value, currently get_the_author_posts_link() creates an anchor tag with am empty target. If shown on the page this results in a link to the current page, which is not what is expected from an author link.

https://core.trac.wordpress.org/browser/tags/4.7.2/src/wp-includes/author-template.php#L252

The attached patch changes this, so that if no link is given, just the author name is returned with no anchor tag surrounding. This is in line with the respective code for get_comment_author_link()

https://core.trac.wordpress.org/browser/tags/4.7.2/src/wp-includes/comment-template.php#L216

Attachments (1)

author-template.php.patch (1.7 KB) - added by SirkoSchindler 16 months ago.

Download all attachments as: .zip

Change History (4)

#1 @swissspidy
16 months ago

  • Keywords has-patch added

#2 @SirkoSchindler
13 months ago

Any updates or comments on this?

#3 @swissspidy
12 months ago

  • Keywords needs-unit-tests added
  • Milestone changed from Awaiting Review to Future Release
Note: See TracTickets for help on using tickets.