#55425 closed enhancement (fixed)
Customize: Fetch presence of published pages more optimally (refactor)
Reported by: | nagpai | Owned by: | nagpai |
---|---|---|---|
Milestone: | 6.0 | Priority: | normal |
Severity: | normal | Version: | 4.7 |
Component: | Customize | Keywords: | has-patch needs-testing |
Focuses: | performance | Cc: |
Description
The function has_published_pages on line 5753 seems to fetch all the data of pages, whereas what is needed is only whether published pages exist or not.
While this may not matter much in sites that have fewer pages, on website that has too many pages, it may create an out of memory error. I will test and submit a patch to fetch only the count of published pages that will help improve efficiency.
Attachments (1)
Change History (9)
#1
@
3 years ago
- Milestone changed from Awaiting Review to Future Release
- Version changed from 5.9.2 to 4.7
#2
@
3 years ago
Hey @dlh , Thank you so much for reviewing this ticket and adding the very useful context! I was traveling last week, and will submit a patch in the next couple of days. Thanks :D
#3
@
3 years ago
- Keywords has-patch needs-testing added; needs-patch removed
I just uploaded a patch. I confirm having tested this on a test site with a few pages published, and none published. It seems to work fine. Would be great if someone can test it too.
This is my first patch submission to WordPress and I hope to do more :) . I have tried to follow the instructions in the contributors' handbook. Advance apologies for any mistakes. Thanks for your kind guidance @dlh !
Also props to my colleague and guide @tyxla who guided me with the next steps too.
This ticket was mentioned in PR #2501 on WordPress/wordpress-develop by peterwilsoncc.
3 years ago
#5
#6
@
3 years ago
- Milestone changed from Future Release to 6.0
I've moved this on the the 6.0 milestone as it appears to be a quick performance win.
To make sure the unit tests still pass, I've set up a linked pull request.
@nagpai I made some minor white space changes to your patch to observe the WordPress PHP coding standards.
Welcome back to Trac, @nagpai! Thanks for the report.
The current logic was added for #38013, where
'number' => 1
was mentioned specifically in the description but not the final patch, so it seems like it was an oversight.Care to submit a patch or a Pull Request? Once we have a patch, I think this ticket can be added to the 6.0 milestone.