How to Remove Items from the WordPress Admin Menu

Sometimes you want to remove a link or two from the WordPress admin menu, the code below shows you a really easy way to do this. This code should be put in your functions.php file.

add_action( 'admin_init', 'my_remove_menu_pages' );

function my_remove_menu_pages() {
  remove_submenu_page( 'themes.php', 'theme-editor.php' );
}

The reason you might want to do this is so that you can simplify the admin for a clients website. The item above in particular removes the theme editor. Leaving it active can be quite dangerous if you hand over your website to a client who thinks they know more than they do. Of course these things should be decided on a case by case basis – many clients are perfectly capable/ responsible and so this won’t be an issue at all.