How to disable theme and plugin editor from WordPress dashboard?

WordPress comes with a built-in editor that allows administrators and super admins to edit plugin and theme code from the dashboard. This feature comes in handy, but can cause serious problems, specially while working on clients projects. To protect your code and website from clients who knows enough to break it down, it is best to hide or disable theme and plugin editor from the dashboard. These are the two ways to do that,

To hide the editor link from dashboard copy the following code snippet and paste it inside your functions.php file.

//Remove theme and plugin editor links
function ccw_hide_editor()
{
	remove_submenu_page('themes.php','theme-editor.php');
	remove_submenu_page('plugins.php','plugin-editor.php');
}
add_action('admin_init','ccw_hide_editor');

The Problem with above code is that, it does not disable the editor but remove the link from dashboard. The editor can still be used by accessing link from URL in browser.

How to Disable Theme and Plugin editor from WordPress Dashboard

To completely disable the editor from WordPress dashboard copy the following code and paste it inside wp-config.php file located in root folder of WordPress installation.

//Disable theme and plugin editor
define( 'DISALLOW_FILE_EDIT', true );

Useful Read: Remove admin color scheme options from WordPress

0 Comments

Leave a Comment.