From b623aca65982b2257d38458c41b591495d9f4ae5 Mon Sep 17 00:00:00 2001 From: Md Rashed Hossain Date: Wed, 18 Jan 2023 12:16:09 +0600 Subject: [PATCH] Update functions.php Many users don't want to use the Gutenberg block editor, so they need to install the classic editor plugin separately. My code will add an option to general settings to enable classic editor, so users don't need to install a plugin for that. --- functions.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/functions.php b/functions.php index dfb9add..260267e 100644 --- a/functions.php +++ b/functions.php @@ -153,3 +153,33 @@ function underscoresme_get_contributors() { return (array) $contributors; } + +/* +* +* Here is a PHP code snippet that can be used to add an option to the WordPress general settings page, which allows you to disable the Gutenberg block editor and enable the classic editor: +*/ + +// Register the setting + add_action( 'admin_init', 'register_classic_editor_settings' ); + function register_classic_editor_settings() { + register_setting( 'general', 'classic_editor_enabled' ); + add_settings_field( 'classic_editor_enabled', 'Classic Editor', 'classic_editor_enabled_callback', 'general' ); + } + // Display the checkbox + function classic_editor_enabled_callback() { + $classic_editor_enabled = get_option( 'classic_editor_enabled', 'enabled' ); + ?> + +