Opened 6 weeks ago
Last modified 2 days ago
#62658 new enhancement
Use WP_Query in wp_get_post_autosave
Reported by: | spacedmonkey | Owned by: | |
---|---|---|---|
Milestone: | 6.8 | Priority: | normal |
Severity: | normal | Version: | 2.6 |
Component: | Revisions | Keywords: | good-first-bug has-patch has-unit-tests |
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 (15)
This ticket was mentioned in PR #7962 on WordPress/wordpress-develop by @narenin.
6 weeks ago
#1
- Keywords has-patch added
This ticket was mentioned in PR #7965 on WordPress/wordpress-develop by @im3dabasia1.
6 weeks 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 weeks 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 weeks ago
#4
Additional props to @im3dabasia who opened #7965
This ticket was mentioned in PR #7969 on WordPress/wordpress-develop by @im3dabasia1.
6 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks ago
#14
@
5 days 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.
Trac ticket: https://core.trac.wordpress.org/ticket/62658