WordPress allows the login user to edit the theme files and plugin files directly through the admin panel. If the users don’t know what file and what changes they change, it may cause the site breaks easily. Often I see the site breaks because the users copy the code they found on the internet and paste it onto the site through the file editor. To avoid this kind of issue, we can disable the theme and plugin file editor menu by using the one-line code.
Where are the Theme and Plugin file editor menus
At the dashboard on the admin panel, navigate to “Appearance>Theme File Editor“.
At the dashboard on the admin panel, navigate to “Plugins>Plugin File Editor“.
Disable Theme and Plugin file editor menus
We will add the code to the wp-config.php.
Here is the code line.
define( 'DISALLOW_FILE_EDIT', true );
Here is some of the code in wp-config.php after adding the disabled code there.
...
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* For information on other constants that can be used for debugging,
* visit the documentation.
*
* @link https://wordpress.org/support/article/debugging-in-wordpress/
*/
define( 'WP_DEBUG', false );
define( 'DISALLOW_FILE_EDIT', true );
/* That's all, stop editing! Happy publishing. */
...
And that’s it.