How to detect if we are in the Site Editor part of the Block Editor (as opposed to editing a Page/Post) in JavaScript?


We use JavaScript to unregister some Core blocks from the Page Editor. We’d like to unregister a slightly different list of blocks when using the Site Editor vs when editing a page or post.

Rather than something clunky to make this determination, such as looking at the current page’s URL, does WordPress provide any native functions we can rely on? Some JavaScript version of get_current_screen or is_site_editor() or similar?

MadtownLems 4 weeks 2023-01-10T14:45:34-05:00 0 Answers 0 views 0

Leave an answer