Opened 2 years ago
Closed 2 years ago
#55666 closed enhancement (invalid)
Add caching to get_block_templates function
Reported by: | spacedmonkey | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.9 |
Component: | Themes | Keywords: | needs-patch |
Focuses: | performance | Cc: |
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
@
2 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.
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.