Opened 4 years ago
Closed 4 years ago
#55666 closed enhancement (invalid)
Add caching to get_block_templates function
| Reported by: | spacedmonkey | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Themes | Version: | 5.9 |
| Severity: | normal | Keywords: | needs-patch |
| Cc: | Focuses: | performance |
Description
The function get_block_templates now calls the WP_Query for every call. This means that every time it requested, it can result in a query to the database. This function should have some level of caching to save duplicate queries on a page load.
Attachments (1)
Change History (4)
#2
@
4 years ago
@peterwilsoncc Great minds think alike.
I had the same thought. But I was thinking have a flag, that defaults to false for caching results. That way we can opt-in usage of WP_Query in core. That way we can roll it out slowly. For this ticket for example, it would simply mean, activating the flag.
Thoughts
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Is it worth working on #22176 during the 6.1 cycle to solve this for multiple functions rather than one by one?
It would be a heap more work but ultimately less effort than to keep adding caching to all the the functions making use of WP_Query.