[wp-trac] [WordPress Trac] #57702: Default to current global post's author in `get_author_posts_url()`.
WordPress Trac
noreply at wordpress.org
Mon Feb 13 00:47:51 UTC 2023
#57702: Default to current global post's author in `get_author_posts_url()`.
---------------------------+-----------------------------
Reporter: peterwilsoncc | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version:
Severity: normal | Keywords:
Focuses: |
---------------------------+-----------------------------
The author of the current post is the default user in the function
`get_the_author_meta()`.
`get_the_author_meta( 'display_name' )` will return the display name of
the current global post's author. `get_the_author_meta( 'display_name',
1260288 )` will return the display name of user 1260288 regardless of the
post object.
This quirk of WordPress allows developers to determine if the requested
user data is for the current post or another purpose when using the
[http://developer.wordpress.org/reference/hooks/get_the_author_field/
get_the_author_{$field} filter].
This behavior is not present in `get_author_posts_url()`, thereby making
obtaining a filtering URLs of the current post's author more difficult.
For the sake of consistency, it would be good to introduce the default
value and match the pattern.
This change would require adding the `$original_url` argument to the
`author_link` filter.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57702>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list