Last active
February 9, 2018 21:26
-
-
Save lukecav/c1b312ef82aa08ff69d603c1f0433edd to your computer and use it in GitHub Desktop.
Kill Gutenberg in WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function kill_gutenberg_post_type( $is_enabled, $post_type ) { | |
if ( ‘post’ === $post_type || ‘page’ === $post_type ) { | |
return false; //==> add_action( ‘admin_print_scripts-edit.php’,…) ==> gutenberg_replace_default_add_new_button is disabled | |
} | |
return $is_enabled; | |
} | |
add_filter( ‘gutenberg_can_edit_post_type’, ‘kill_gutenberg_post_type’, 10, 2 ); //gutenberg_add_edit_link_for_post_type | |
function kill_gutenberg_modify_add_new_button_url( $url, $path ) { | |
return str_replace(‘&classic-editor’,”,$url); | |
} | |
add_filter( ‘admin_url’, ‘kill_gutenberg_modify_add_new_button_url’, 10, 2 ); | |
function kill_gutenberg_add_gutenberg_post_state( $post_states, $post ) { | |
return []; | |
} | |
add_filter( ‘display_post_states’, ‘kill_gutenberg_add_gutenberg_post_state’, 10, 2 ); | |
// gutenberg.php | |
remove_filter( ‘replace_editor’, ‘gutenberg_init’ ); | |
remove_action( ‘load-post.php’, ‘gutenberg_intercept_edit_post’ ); | |
remove_action( ‘load-post-new.php’, ‘gutenberg_intercept_post_new’ ); | |
remove_action( ‘admin_notices’, ‘gutenberg_wordpress_version_notice’ ); | |
remove_action( ‘admin_init’, ‘gutenberg_redirect_demo’ ); | |
remove_action( ‘admin_menu’, ‘gutenberg_menu’ ); | |
// lib/client-assets.php | |
remove_action( ‘wp_enqueue_scripts’, ‘gutenberg_register_scripts_and_styles’, 5 ); | |
remove_action( ‘admin_enqueue_scripts’, ‘gutenberg_register_scripts_and_styles’, 5 ); | |
remove_action( ‘wp_enqueue_scripts’, ‘gutenberg_common_scripts_and_styles’ ); | |
remove_action( ‘admin_enqueue_scripts’, ‘gutenberg_common_scripts_and_styles’ ); | |
// lib/compat.php | |
remove_action( ‘wp_enqueue_scripts’, ‘gutenberg_ensure_wp_api_request’, 20 ); | |
remove_action( ‘admin_enqueue_scripts’, ‘gutenberg_ensure_wp_api_request’, 20 ); | |
remove_filter( ‘wp_editor_settings’, ‘gutenberg_disable_editor_settings_wpautop’ ); | |
remove_filter( ‘wp_refresh_nonces’, ‘gutenberg_add_rest_nonce_to_heartbeat_response_headers’ ); | |
// lib/register.php | |
remove_action( ‘rest_api_init’, ‘gutenberg_register_rest_routes’ ); | |
// Metaboxes hacks | |
remove_action( ‘do_meta_boxes’, ‘gutenberg_meta_box_partial_page’, 1000 ); | |
remove_action( ‘plugins_loaded’, ‘gutenberg_trick_plugins_into_registering_meta_boxes’ ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment