When you are developing a wordpress theme, you may do not want users to edit your theme files. In this tutorial, we will introduce you how to do.
The theme editor looks like:
We will use add_action() to implement this function, which will not edit wp-config.php file.
Some tutorials introduce a simple way to disable theme editor, for example, you can add code below in wp-config.php.
define('DISALLOW_FILE_EDIT', true );
Which is not a good way, we will use other method.
Open your theme functions.php and add code below:
function remove_submenu() { remove_submenu_page( 'themes.php', 'theme-editor.php' ); } add_action('admin_init','remove_submenu');
Then you will remove theme editor.