Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Disable Gutenberg in WordPress 5.0
<?php
/*
Plugin Name: WeAreWP Gutenberg
Description: Disable Gutenberg in WordPress 5.0
Plugin URI: https://www.wearewp.pro
Version: 1.0
Author: WeAre[WP]
Author URI: https://www.wearewp.pro
*/
if ( ! defined( 'ABSPATH' ) ) {
die( 'Cannot access pages directly.' );
}
/**
*
* Disbale Gutenberg only for All Custom Post Type
*
**/
// Newer versions of Gutenberg (4.1+), and WordPress 5.0 beta
add_filter('use_block_editor_for_post', '__return_false');
// Older versions of Gutenberg (less than 4.1), and WordPress versions less than 5.0 beta
add_filter('gutenberg_can_edit_post_type', '__return_false');
/** ---------------------------------------------------------------------------------- **/
/**
*
* Disbale Gutenberg only for Custom Post Type Testinonial
*
**/
// Newer versions of Gutenberg (4.1+), and WordPress 5.0 beta
add_filter('use_block_editor_for_post_type', 'wearewp_disable_gutenberg', 10, 2);
// Older versions of Gutenberg (less than 4.1), and WordPress versions less than 5.0 beta
add_filter('gutenberg_can_edit_post_type', 'wearewp_disable_gutenberg', 10, 2);
function wearewp_disable_gutenberg( $is_enabled, $post_type ) {
// Change testimonial to your post type
if ($post_type === 'testimonial'){
return false;
}
return $is_enabled;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.