WordPress Disable Block Editor and Enable Classic Editor


<?php
public function disable_gutenberg() {
global $wp_filter;
$callbacks_array = $wp_filter['init']->callbacks;
foreach( $wp_filter as $tag => $priorities ) {
foreach( $priorities->callbacks as $priority => $callback_data ) {
foreach( $callback_data as $callback_function_name => $callback_function_data ) {
if ( strpos( $callback_function_name, 'disable_gutenberg' ) !== false ){
continue;
}
// Gutenberg Disabler
if ( strpos( $callback_function_name, 'gutenberg' ) !== false || strpos( $callback_function_name, 'block_editor' ) ){
remove_filter( $tag, $callback_function_name, $priority );
}
}
}
}
$wp_filter['init']->callbacks = $callbacks_array;
add_filter( 'use_block_editor_for_post_type', '__return_false' );
}
// register in hook
add_action( 'admin_init', array($this, 'disable_gutenberg') );

Comments

Popular posts from this blog

Loading App Configuration from API Before Application Start in Flutter Using Provider, Similar to Angular's APP_INITIALIZER

When to Use Flutter's FutureBuilder and Consumer for Data Retrieval from Provider?