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); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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-area
parent block. Anyone know of a different way to know which of these three contexts my block is displaying within?Beta Was this translation helpful? Give feedback.
All reactions