#62658 closed enhancement (fixed)
Use WP_Query in wp_get_post_autosave
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.8 | Priority: | normal |
Severity: | normal | Version: | 2.6 |
Component: | Revisions | Keywords: | good-first-bug has-patch has-unit-tests commit |
Focuses: | performance | Cc: |
Description
Use WP_Query in wp_get_post_autosave and replace the raw database query.
WP_Query is cached and has a number of useful filters.
Change History (25)
This ticket was mentioned in PR #7962 on WordPress/wordpress-develop by @narenin.
6 months ago
#1
- Keywords has-patch added
This ticket was mentioned in PR #7965 on WordPress/wordpress-develop by @im3dabasia1.
6 months ago
#2
Trac ticket: https://core.trac.wordpress.org/ticket/62658
Refactored the function to use WP_Query instead of raw SQL query.
@swissspidy commented on PR #7965:
6 months ago
#3
Thanks for your PR! Looks like #7962 was a bit quicker, so let's consolidate the two.
@swissspidy commented on PR #7962:
6 months ago
#4
Additional props to @im3dabasia who opened #7965
This ticket was mentioned in PR #7969 on WordPress/wordpress-develop by @im3dabasia1.
6 months ago
#6
- Keywords has-unit-tests added; needs-unit-tests removed
Trac ticket: https://core.trac.wordpress.org/ticket/62658
This PR adds unit tests for the wp_get_post_autosave()
function. The tests cover:
- Checking if a post has no autosave.
- Verifying that an autosave is created after a revision.
- Ensuring autosaves are added for a specific user.
@im3dabasia1 commented on PR #7969:
6 months ago
#7
Hey @swissspidy,
I’ve added some unit tests. This is my first time contributing to unit tests, and I included the previous diff in my PR as I wasn’t sure of the best way to write tests for the new diff.
Please, whenever you have a moment, could you check this and provide feedback?
@swissspidy commented on PR #7969:
6 months ago
#8
No need to create a new PR for the tests, you can add them to the existing one.
@im3dabasia1 commented on PR #7969:
6 months ago
#9
No need to create a new PR for the tests, you can add them to the existing one.
Thanks for your suggestion! I’m not entirely sure how I can push changes directly into someone else’s PR. I’m also unsure if I have write access to the branch for this PR, so I’m uncertain about the process for doing that.
When I reviewed other tickets that required unit tests in the past, I saw that a separate patch or PR was raised for those. I followed that approach here, assuming it was the preferred method.
Could you kindly guide me on how to proceed with adding the unit tests to the existing PR? I’d appreciate your help!
@mukesh27 commented on PR #7969:
6 months ago
#11
Closing as it incorporate in original PR https://github.com/WordPress/wordpress-develop/pull/7962/commits/e96123449010208bc3e185579d6f76faf31ce8e2
This ticket was mentioned in Slack in #core-performance by spacedmonkey. View the logs.
6 months ago
#14
@
5 months ago
From what I can tell, the PR https://github.com/WordPress/wordpress-develop/pull/7962 could use a follow up review. @spacedmonkey Any chance you can take another look? I'm asking since you requested changes previously.
@mukesh27 commented on PR #7962:
5 months ago
#16
@narenin take a look pending feedback https://github.com/WordPress/wordpress-develop/pull/7962#discussion_r1875403456 from @spacedmonkey
@im3dabasia1 commented on PR #7962:
5 months ago
#19
Hi @spacedmonkey,
Would we be eligible to receive the Testing badge once this PR is merged? I initially contributed to the tests in the PR, which was later merged into this PR. I was wondering if I might still be eligible for the badge.
Nice work @narenin 💯
5 months ago
#20
@spacedmonkey thanks for the feedbacks, I have implemented the suggestions could you please take the look.
@swissspidy commented on PR #7962:
5 months ago
#21
@im3dabasia See https://make.wordpress.org/test/handbook/test-team-profile-badges/ for that badge and its requirements and how to request it if you meet them.
@spacedmonkey LGTM
This ticket was mentioned in PR #8198 on WordPress/wordpress-develop by @spacedmonkey.
5 months ago
#23
Trac ticket:
@spacedmonkey commented on PR #8198:
5 months ago
#25
Committed in https://core.trac.wordpress.org/changeset/59715
Trac ticket: https://core.trac.wordpress.org/ticket/62658