-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix performance issue #3609
Fix performance issue #3609
Conversation
@@ -351,7 +351,8 @@ function _add_block_template_info( $template_item ) { | |||
return $template_item; | |||
} | |||
|
|||
$theme_data = WP_Theme_JSON_Resolver::get_theme_data()->get_custom_templates(); | |||
$theme_data = WP_Theme_JSON_Resolver::get_theme_data( array(), array( 'with_supports' => false ) )->get_custom_templates(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@felixarntz @desrosj @peterwilsoncc This work, because, supports are not needed here. You just need a WP_Theme_Json object. Adding these params, means that it hits a cache that it would not before. This function is called 300+ times a page load, there some serious savings here.
Closing in favour of #3624 |
Though I'm not super familiar with this code, the suggested change looks like an easy win. I was wondering about |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spacedmonkey Looks great, only pending @SergeyBiryukov's question.
@@ -371,7 +372,7 @@ function _add_block_template_info( $template_item ) { | |||
*/ | |||
function _add_block_template_part_area_info( $template_info ) { | |||
if ( WP_Theme_JSON_Resolver::theme_has_support() ) { | |||
$theme_data = WP_Theme_JSON_Resolver::get_theme_data()->get_template_parts(); | |||
$theme_data = WP_Theme_JSON_Resolver::get_theme_data( array(), array( 'with_supports' => false ) )->get_template_parts(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SergeyBiryukov This works well!
@felixarntz Actioned the feedback. |
Committed. |
Trac ticket: https://core.trac.wordpress.org/ticket/57077
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.