How to hide theme editor from WordPress dashboard

September 20, 2012 at 3:39 pm

If you’re a freelancer who often install WordPress on your clients websites, chances are that you don’t want them to be able to edit their theme. Here is a simple code snippet to hide the Theme Editor link from the dashboard so you can be sure that your clients won’t destroy their theme.

Simply paste the following code on the theme functions.php file. Specify the admin username on line 7 so the admin will still see the theme editor link.

function wpr_remove_editor_menu() {
  remove_action('admin_menu', '_add_themes_utility_last', 101);

global $remove_submenu_page, $current_user;
if($current_user->user_login == 'admin') { //Specify admin name here
    add_action('admin_menu', 'wpr_remove_editor_menu', 1);