#55978 closed defect (bug) (fixed)
Adding optional post parameter to get_the_modified_author function
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.9 | Priority: | normal |
| Severity: | normal | Version: | 2.8 |
| Component: | Posts, Post Types | Keywords: | has-patch |
| 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 (20)
#2
@
3 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
@
3 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
@
3 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
@
3 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.
3 years ago
#7
@
3 years 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.
3 years ago
#8
#10
@
3 years 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().
This ticket was mentioned in Slack in #core by mukeshpanchal27. View the logs.
3 years ago
This ticket was mentioned in Slack in #core by mukeshpanchal27. View the logs.
3 years ago
#13
@
3 years ago
- Milestone changed from 6.2 to Future Release
Thanks @samirmalpande for the ticket.
This ticket was discussed during the bug scrub. as this ticket still needs more functions covered. 6.2 Beta 1 is being released today, I'll move this to Future Release.
Additional props: @costdev
#14
@
3 weeks ago
- Keywords dev-feedback changes-requested removed
I'm fixing get_the_modified_author() as part of #64104. I'll have it also close this ticket. If we want to do something for get_the_author() and the_author() let's do so in another fresh ticket.
#17
@
3 weeks ago
- Type changed from enhancement to defect (bug)
Note: Even though this is categorized as an enhancement I'm deeming it a defect because it get_the_modified_author() is missing a $post parameter in the same way that get_the_modified_date() and get_the_modified_time() have one. Since get_the_modified_author() never had an argument before, there isn't the complication that exists with get_the_author()/the_author().
@westonruter commented on PR #3881:
3 weeks ago
#19
Closed by r61057.
Patch file