Skip to content

Instantly share code, notes, and snippets.

@jeffreyvr
Created August 18, 2020 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffreyvr/b5c3f5dfaa262e6fd14bb70a3766cdf9 to your computer and use it in GitHub Desktop.
Save jeffreyvr/b5c3f5dfaa262e6fd14bb70a3766cdf9 to your computer and use it in GitHub Desktop.
Is Gutenberg active
<?php
function prefix_is_gutenberg_active() {
include_once ABSPATH . 'wp-admin/includes/plugin.php';
$is_gutenberg = has_filter( 'replace_editor', 'gutenberg_init' ) || version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' );
$is_classic_editor = is_plugin_active( 'classic-editor/classic-editor.php' ) && get_option( 'classic-editor-replace' ) === 'no-replace';
if ( $is_gutenberg && ! $is_classic_editor ) {
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment