How to Remove the Theme Editor Menu from the WordPress Dashboard

The WordPress dashboard contains a menu item that allows you to edit any installed WordPress theme under Appearance >> Editor. However, there are times when you may not want anyone poking around in there, since it’s quite easy to make errors that will take the website down entirely.

Here’s a handy snippet to help with this issue, courtesy of Filip Stefansson, creator of WP-Snippets. Simply paste this into your theme’s functions.php file:

function remove_editor_menu() {
  remove_action('admin_menu', '_add_themes_utility_last', 101);
add_action('_admin_menu', 'remove_editor_menu', 1);

This code will remove the Editor menu from the dashboard so that users cannot accidentally ruin their own website. Save yourself a little bit of trouble if you think this could be a problem and add this short snippet.

Comments (5)

  1. Great post, but can’t you just use a role plugin manager? I know plugins slow things down, but if you implement this then isn’t everyone blocked from accessing easily form back-end including admin (usually web builder too)?

  2. What about a plugin to hide menu options (theme, editor, plugins etc )from clients and limit users based on roles and capabilities.

    Now that would be a great plugin:)

    Maybe included into your white label branding plugin.