Repository navigation
Replies: 1 comment
|
You could try getting the screen instance from the respective admin page and compare it. If you need the info in the frontend, you can pass it through. add_action('current_screen', function() {
$screen = get_current_screen();
if ($screen->base === 'customize') echo 'Customizer Screen';
}, 10); |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I was able to write something for a block to know whether it's being displayed in the block editor or the widget editor (admin page)... basically by checking if the block has a "core/widget-area" as a parent/ancestor.
However, the customizer version of the widget editor doesn't wrap the blocks in a
core/widget-areaparent block. Anyone know of a different way to know which of these three contexts my block is displaying within?All reactions