Skip to content
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

Avoid changing non-theme-preview requests #51221

Merged

Conversation

okmttdhr
Copy link
Contributor

@okmttdhr okmttdhr commented Jun 5, 2023

What?

This PR prevents Block Theme Previews from changing non-theme-preview requests.

Why?

The current implementation would empty the original stylesheet when "there is a URL query (?theme_preview=) but no theme preview permission" (this behavior was introduced in #50338).
This unintentionally breaks functionality other than Block Theme Previews, so it has been modified not to change it except when Block Theme Previews should be applied.

How?

  • Return the original value when Block Theme Previews should not be applied.

Testing Instructions

  • Open the Site Editor and add the following to your URL: ?theme_preview=[themePath] where themePath is the relative path to the theme you want to preview (e.g. twentytwentythree).
@okmttdhr okmttdhr marked this pull request as ready for review June 5, 2023 03:26
Copy link
Contributor

@draganescu draganescu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good catch, there should be no effect in trying to preview without permission.

@draganescu draganescu merged commit 27b78f2 into WordPress:trunk Jun 5, 2023
48 checks passed
@github-actions github-actions bot added this to the Gutenberg 16.0 milestone Jun 5, 2023
@okmttdhr okmttdhr deleted the update/block-theme-previews-fix branch June 6, 2023 01:07
@ndiego ndiego added [Type] Bug An existing feature does not function as intended [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. labels Jun 7, 2023
@ramonjd ramonjd added the Needs PHP backport Needs PHP backport to Core label Jun 8, 2023
@ramonjd
Copy link
Member

ramonjd commented Jun 8, 2023

Hello! Do you folks think theme previews will be part of WordPress 6.3? I'll add it to the backport issue to be sure. If not, we can remove it.

Thanks!

cc @scruffian

@draganescu
Copy link
Contributor

@ramonjd if there is no major blocker appearing in the mean time I think so yes!

@scruffian
Copy link
Contributor

Yes I agree, I hope it will be in 6.3.

@ramonjd
Copy link
Member

ramonjd commented Jun 8, 2023

Thanks for the feedback!

@ramonjd ramonjd removed the Needs PHP backport Needs PHP backport to Core label Jun 30, 2023
sethrubenstein pushed a commit to pewresearch/gutenberg that referenced this pull request Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Type] Bug An existing feature does not function as intended
5 participants