[wp-trac] [WordPress Trac] #46195: is_block_editor() returns false in the block editor
WordPress Trac
noreply at wordpress.org
Wed Feb 6 13:39:39 UTC 2019
#46195: is_block_editor() returns false in the block editor
--------------------------+-----------------------------
Reporter: Chouby | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 5.0
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
The `current_screen` action is supposed to be fired after the necessary
elements to identify a screen are set up. So I would expect that
`$screen->is_block_editor()` returns the right value in a function hooked
to `current_screen`. But in fact `$screen->is_block_editor()` always
return false even if are in the block editor.
That's because the property `is_block_editor` is set much later, after
`current_screen` action is fired.
This small code snippet allows to reproduce the issue:
{{{
add_action( 'current_screen', function( $screen ) {
error_log( var_export( $screen->is_block_editor(), true ) );
} );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46195>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list