Last active
February 3, 2019 03:13
-
-
Save senlin/691c5f06459857f57247dc92f7ec1406 to your computer and use it in GitHub Desktop.
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…
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
/** | |
* 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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Available as official plugin now: https://github.com/senlin/classic-editor-addon