How You Can Hide Theme Editor From WordPress Dashboard ?

If you like hiding WordPress theme editor from dashboard then all you need to is add a function in your theme function file.  Copy and paste the following code in your theme’s function.php file editing the username given in the following code to you own. Changing the username in the following code will make theme editor visible to that admin who’s username is written in the code:

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 == ‘username’) {
add_action(‘admin_menu’, ‘wpr_remove_editor_menu’, 1);
}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.