Classic or block editor |

Hi Jacob,

Nothing simple, as it’s possible for users to freely switch between editors. The classic editor plugin tracks which editor was used last on a particular post if switching is enabled, but post content can be composed of both blocks and classic content. All blocks are bounded by wp:* style comment labels, classic elements are not, but which it is is not readily apparent to the shortcode handler. In any case, it strikes me as an inherently weak way to determine editor type.

Shortcodes as you know normally work in either editor. What is it about your shortcodes that prevents them from working in the block editor? Is there not any way to cause them to work in either editor?

Thanx for your reply, but i found what i need: WP_Screen::is_block_editor();

Heh, that’s pretty simple. TIL…
Thanks Jacob

Source link