[wp-trac] [WordPress Trac] #59314: Cache the result of template file lookups

WordPress Trac noreply at wordpress.org
Tue Oct 31 23:09:05 UTC 2023


#59314: Cache the result of template file lookups
-----------------------------------+--------------------------
 Reporter:  joemcgill              |       Owner:  thekt12
     Type:  enhancement            |      Status:  assigned
 Priority:  normal                 |   Milestone:  6.5
Component:  Themes                 |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  2nd-opinion has-patch  |     Focuses:  performance
-----------------------------------+--------------------------

Comment (by thekt12):

 In PoC, we found that it's not so easy to bypass `locate_block_template`
 as it updates global `$_wp_current_template_content`, which is directly
 consumed by `get_the_block_template_html` while rendering the template.

 If we wish to bypass `locate_block_template`, we need to persistent cache
 both
 `$_wp_current_template_content` and `$_wp_current_template_id` globals
 (which gets updated by locate_block_template). Caching globals will
 increase the chance of having an unknown side effect.

 I am proceeding with only the `file_exists` cache now to get the metrics.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59314#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list