WordPress / twentytwenty

Twenty Twenty is included in Core as of WordPress 5.3 🎉 To report any issues, please go here: https://core.trac.wordpress.org/newticket
Other
300 stars 138 forks source link

Load the starter content only when within the customizer #974

Closed schlessera closed 4 years ago

schlessera commented 4 years ago

To avoid parsing the starter content on every single page request, we only add the theme support for the starter content when is_customizer_preview() is true.

Fixes #973

pattonwebz commented 4 years ago

@schlessera Does this also fix all the problems that you were facing in WP-CLI as well caused by this?

schlessera commented 4 years ago

@pattonwebz I'm not sure, and it is actually difficult to test if the change is not in a release.

However, I've built a work-around for WP-CLI already to make sure I'm not hit by this when 5.3 is released: https://github.com/wp-cli/wp-cli-tests/pull/72

schlessera commented 4 years ago

In your test, can you add a wp_die() in the root of the starter-content theme and see if it is only hit in the customizer, and does not break outside of it?

pattonwebz commented 4 years ago

@schlessera I tested this with xDebug (and again I tested with your wp_die() method) and the file/function is only hit on customizer pages as expected. I haven't found any other admin pages that it fires on but there may be some places or situations in the dashboard that resolve to true on is_customize_preview() but I have not found any of those in my browsing around just now.

This seems good to me but I will test for another few minutes to make sure I am not missing anything, if I run into no troubles I will merge this in :)