-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Back Compat: Add Patterns submenu for WordPress 6.4 #60804
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
I'm glad there's a way to make this happen sooner for classic themes. Nice work @t-hamano 🎉
It tests well for me:
✅ Block Themes are not affected
✅ Patterns menu appears under Appearance for classic and hybrid themes
✅ Patterns menu links to wp-admin/edit.php?post_type=wp_block
✅ Site Editor patterns page could be accessed directly
✅ Not denied access to site editor's pattern page when reloading, navigating back etc.
✅ Non-pattern pages in the site editor were not accessible
The code changes reflect the relevant code within core's site-editor.php
as well as other existing approaches to adding menu items e.g. Widgets.
LGTM 🚢
Nice one indeed :) |
Thanks for the review! |
Part of #52150
Related core changeset: https://core.trac.wordpress.org/changeset/57543
What?
This PR applies the following changes implemented in WP 6.5 (Changeset 57543) to WP 6.4 and below + Gutenberg plugin environments:
wp-admin/edit.php?post_type=wp_block
) under the Appearance menu for the Classic themewp-admin/site-editor.php?path=%2Fpatterns
) internally for the Classic themeWhy?
A roadmap for publishing the new Patterns page to the classic theme is mentioned in this comment. We originally thought that we would not be able to publish the new Patterns page to the Classic theme until the minimum version supported by the Gutenberg plugin was WP 6.5. However, we found that by filtering
wp_die(
) itself, it is possible to publish the new Pattern page internally even in environments with WP 6.4 or lower.This should allow us to officially publish the new Patterns page for the Classic theme in the next major WordPress release (6.6) without worrying about backwards compatibility issues.
How?
I added two hooks to accomplish the same thing with this changeset.
Testing Instructions
http://localhost:8889/wp-admin/
).wp-admin/edit.php?post_type=wp_block
).http://localhost:8889/wp-admin/site-editor.php?path=%2Fpatterns
) directly.http://localhost:8889/wp-admin/site-editor.php
http://localhost:8889/wp-admin/site-editor.php?canvas=edit
http://localhost:8889/wp-admin/site-editor.php?path=%2Fnavigation
http://localhost:8889/wp-admin/site-editor.php?path=%2Fwp_global_styles
http://localhost:8889/wp-admin/site-editor.php?path=%2Fpage
http://localhost:8889/wp-admin/site-editor.php?path=%2Fwp_template
Next Step
This PR is purely to enable changes made in WP 6.5 to work in environments below WP 6.4. In order to expose the new Patterns page to the classic theme in WP 6.6, I would like to continue working on the following tasks: