Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Classic Editor Addon by SO WP & Greg Schoppe - Classic Editor plugin doesn't remove Gutenberg by default. With this addon function we set the option that controls this from no-replace to replace, we remove the Settings link from the main Plugins page and we hide the Settings from the Settings > Writing screen. We also suppress the Nag screen tha…
/**
* Classic Editor Addon by SO WP
*
* Classic Editor plugin doesn't remove Gutenberg by default
* with this function we set the option that controls this from no-replace to replace
* and we remove the Settings link from the main Plugins page
*
* Add this to your theme's functions.php file or functionality plugin
* Released by Pieter Bos of SO WP (https://so-wp.com)
*/
if ( function_exists( 'classic_editor_init_actions' ) ) {
// Classic Editor is active, continue
/**
* Change the default option of "no-replace" to "replace",
* which means the checkbox will be unticked and the bloody plugin
* does what it says from the get-go (L336).
*/
$option_name = 'classic-editor-replace' ;
$new_value = 'replace' ;
if ( get_option( $option_name ) == 'no-replace' ) {
// The option already exists, so we just update it.
update_option( $option_name, $new_value );
}
/**
* Remove Settings link to the settings from the Plugins screen (L277).
*/
add_filter( 'plugin_action_links', 'classic_editor_remove_settings_link', 10, 2 );
function classic_editor_remove_settings_link( $links, $file ) {
if ( $file === 'classic-editor/classic-editor.php' && current_user_can( 'manage_options' ) ) {
array_shift( $links );
}
return $links;
}
}
@senlin

This comment has been minimized.

Copy link
Owner Author

commented Jul 9, 2018

Available as official plugin now: https://github.com/senlin/classic-editor-addon

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.