Hide Theme Editor from WordPress Dashboard
Do you want to remove the theme editor from your WordPress blog/website? There can be various scenarios when the theme editor is not required at all in the WordPress dashboard. For instance, you are creating a website for your client who does not need to make any changes to the theme. You might have multiple administrators for your website, but you do not want them to have access to the theme edit panel. Then there is the risk of an accidental change to the theme.
With just one line of code, you can disable the theme editor from your WordPress dashboard. Copy the code below and paste it in the wp-config.php file of your WordPress installation. You can find this file in the main folder of your WordPress installation.
define('DISALLOW_FILE_EDIT', TRUE);
Alternatively, you can paste the following code in the functions.php file of your theme.
function wpr_remove_editor_menu() { remove_action('admin_menu', '_add_themes_utility_last', 101); } global $remove_submenu_page, $current_user; get_currentuserinfo(); if($current_user->user_login == 'admin') { //Specify admin name here add_action('admin_menu', 'wpr_remove_editor_menu', 1); }