The new editor called Gutenberg is here as plugin in 4.9, and as core functionality called Block Editor, in 5.0. Regarding to it, it is often needed to determine programmatically which editor is used to edit post or page in the site console.
There are several variants:
- WordPress 4.9, Gutenberg plugin is not active
- WordPress 4.9, Gutenberg plugin is active
- WordPress 5.0, Block Editor by default
- WordPress 5.0, Classic Editor plugin is active
- WordPress 5.0, Classic Editor plugin is active, but in site console in “Settings > Writing” the option “Use the Block editor by default…” is selected
All the mentioned variants can be processed by the following code: