-
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
is_block_editor() returns inconsistent result in core versus in plugin #32215
Comments
The code for the widget screen was merged to core yesterday and included this: So I think The Gutenberg plugin has done things a different way using the filter below, and I don't think that modifies the gutenberg/lib/widgets-page.php Lines 83 to 91 in 87ad8f3
So this is probably something we want to revisit in terms of the plugin. I think it should be consistent with core, else we might see some unexpected issues. I remember I did propose making is_block_editor For the customizer, that's a bit of a more nuanced situation since the widget editor is only a small part of the customizer experience, but you're right in that there needs to be some assurances that block based plugins should work. I know we've tested a number of plugins and they don't seem to have any issues (beyond a few known ones). |
Thanks for the response and pointers to the code snippets. I have implemented a local On edit.php when editing a post these return This inconsistency makes it quite a challenge to ensure plugin code is loaded where it is needed. |
I think let's make it like this in both core and the plugin:
In retrospect I think we never should have added |
This is related to #28517. We ought to move away from |
@noisysocks @mattyrob Just wanted to check if this is still occuring in WP6.3 or if it has been resolved? |
@jordesign - I'm not sure I'm in a position to answer as I moved away from relying on On a quick check today in WordPress 6.3 it seems it now only evaluates to true in I am unable to comment on what |
No worries at all @mattyrob - I'll leave this open so it can be further investigated |
What problem does this address?
At the moment the logic required in plugins or themes for hooking block code for the new Widget Screen and Widget Customizer needs to be extended beyond simply checking if
is_block_editor()
evaluates totrue
because on those screens it currently returnsfalse
.What is your proposed solution?
$current_screen->is_block_editor()
should evaluate totrue
on all screen where plugins and themes are able to extend the core Block Editor.As such this should extend to screens where
$current_screen->id
is in the following list:widgets
customize
appearance_page_gutenberg
And there may well be others I have not tripped over yet.
The text was updated successfully, but these errors were encountered: