#51859 closed enhancement (fixed)
Add filter to get_the_author_link
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Formatting | Keywords: | has-patch has-unit-tests needs-dev-note |
Focuses: | Cc: |
Description
In order to allow customization of the markup, including adding classes for styling, and changing the rel properties, suggest the introduction of a get_the_author_link filter to allow this to be edited.
Change History (11)
This ticket was mentioned in PR #772 on WordPress/wordpress-develop by donmhico.
4 years ago
#1
- Keywords has-patch added
#4
@
3 years ago
- Keywords needs-refresh 2nd-opinion added
@since
mentions needs to be refreshed. Also, instead of passing $author_url
and $display_name
specific variables, should we rather pass a full WP_User
object?
#5
@
3 years ago
@audrasjb That sounds fine. Could use the $authordata
global. This would make all user data available to the filter callback.
One other concern I have here is potential confusion with the existing author_link filter. I think renaming this new filter to author_url_link_html
would be more appropriate.
I'm working on adding some unit tests for this new filter. I'll throw up a PR for easier review.
This ticket was mentioned in PR #2439 on WordPress/wordpress-develop by dream-encode.
3 years ago
#6
- Keywords has-unit-tests added; needs-refresh removed
Core Trac ticket: https://core.trac.wordpress.org/ticket/51859.
dream-encode commented on PR #772:
3 years ago
#9
Thanks for the PR! This was merged into core in https://core.trac.wordpress.org/changeset/53147.
dream-encode commented on PR #2439:
3 years ago
#10
Merged into core in https://core.trac.wordpress.org/changeset/53147.
Apply filter to author's HTML link using
author_html_link
filter.Example usage
{{{php
/
add_filter( 'author_html_link', function( $html_link, $author_url, $display_name ) {
}, 10, 3 );
}}}
Trac ticket: https://core.trac.wordpress.org/ticket/51859