Opened 2 years ago
Last modified 21 months ago
#55978 new enhancement
Adding optional post parameter to get_the_modified_author function
Reported by: | samirmalpande | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 2.8 |
Component: | Posts, Post Types | Keywords: | has-patch dev-feedback changes-requested |
Focuses: | Cc: |
Description
With the current implementation of the get_the_modified_author()
it is not possible to use this function with the custom WP_Query loop. It takes the post ID using the get_post()
which returns the global post id and there is no way to pass the ID from the custom query.
We want to add the optional post parameter in get_the_modified_author
function so that we can use this function in custom loops as well.
By doing this change we also make this function follow the same standard as other "get_the_" functions like get_the_title
, get_the_content
, get_the_terms
etc.
Attachments (1)
Change History (14)
#2
@
2 years ago
- Keywords changes-requested removed
- Milestone changed from Awaiting Review to 6.1
- Version changed from trunk to 2.8
Thanks for the ticket and the patch @samirmalpande 👍
#3
@
2 years ago
Should get_the_author()
get the same parameter for consistency?
It used to have an $idmode
parameter, which was deprecated in [4146] / #2386. Since it only accepted a string, I think we should be able to un-deprecate and use it if an integer post ID or a WP_Post
object is passed. There is a precedent for something like this, see [47366] / #48772.
#4
@
2 years ago
Ideally get_the_author()
should also have same parameter. Since we have a precedent to un-deprecate the parameter, we should pass the $post
parameter to get_the_author()
.
Should we create a new ticket for this or include it in the same patch?
#5
@
2 years ago
- Keywords needs-refresh changes-requested added
- Milestone changed from 6.1 to 6.2
@samirmalpande Could you refresh the current patch?
@SergeyBiryukov what do you think about protecting against edge cases by throwing a __doing_it_wrong()
notice if the value is not an integer post ID or WP_Post
object?
Since 6.1 beta 1 is due out in less than 12 hours (the cut off for enhancement and feature request tickets), I'm going to punt this one. But if a refreshed patch is added in time and a committer has bandwidth to review, it can be moved back.
This ticket was mentioned in Slack in #core by costdev. View the logs.
21 months ago
#7
@
21 months ago
- Keywords dev-feedback added; needs-refresh removed
This ticket was reviewed in the bug scrub. As the patch still applies cleanly against trunk
, I'm removing the needs-refresh
keyword. The changes-requested
keyword is accurate. Also adding dev-feedback
to draw attention to Jonathan's comment above.
This ticket was mentioned in PR #3881 on WordPress/wordpress-develop by @audrasjb.
21 months ago
#8
#10
@
21 months ago
- Keywords changes-requested added
I added a refreshed PR but I'm re-adding the changes-requested
workflow keyword since I forgot to cover other functions like get_the_author()
/the_author()
.
Patch file