Skip to content

Conversation

@okmttdhr
Copy link

This PR fixes WordPress/gutenberg#53284. #4959 tried to fix the same issue, but there is a concern about its reliability, depending on timing.

Hence, this PR changed to load theme-previews.php, which is the cause of this issue, after the pluggable functions. The reason for this is that running capability checks before defining pluggable functions itself does not seem to be a good approach.

Fixes WordPress/gutenberg#53284
Trac ticket: https://core.trac.wordpress.org/ticket/59000


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.

@okmttdhr okmttdhr marked this pull request as ready for review August 18, 2023 06:34
@okmttdhr okmttdhr changed the title Load theme-preview.php after pluggable functions get defined Load theme-preview.php after pluggable functions get defined Aug 18, 2023
@okmttdhr
Copy link
Author

Hello, @SergeyBiryukov @johnbillion!
I've made the changes as described in the PR to make the block theme previews work on every site. I'd appreciate it if you take a look!

Both failing tests (E2E, performance) are passing on my local, at least.
Screen Shot 2023-08-18 at 16 35 34
Screen Shot 2023-08-18 at 16 35 42

@scruffian
Copy link
Contributor

This makes perfect sense to me, thanks for working on it.

@okmttdhr
Copy link
Author

Hello, @azaozz @mtias @noisysocks!
To fix the crash of Block Theme Previews, I'd appreciate it if you could review and commit this change to the core. Thank you in advance!

@okmttdhr
Copy link
Author

okmttdhr commented Aug 31, 2023

Hello, @azaozz @mtias @noisysocks! To fix the crash of Block Theme Previews, I'd appreciate it if you could review and commit this change to the core. Thank you in advance!

I'm closing this PR in favor of a new one: #5107.

@okmttdhr okmttdhr closed this Aug 31, 2023
@okmttdhr okmttdhr deleted the fix/theme-preview-timing branch August 31, 2023 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Block Theme Previews does not work if we call the get_template or get_stylesheet functions early

2 participants