Skip to content
PHP

How to disable Theme Editor and Plugin Editor in the WordPress admin panel?

A
Author
Jun 8, 2021 · 1 min read
How to disable Theme Editor and Plugin Editor in the WordPress admin panel?

The Theme Editor and Plugin Editor in the WordPress admin panel allow users to directly edit the code of themes and plugins, which can be a security risk if a user with malicious intent gains access to your WordPress site. Therefore, it is recommended to disable the Theme Editor and Plugin Editor in the WordPress admin panel. Here’s how:

  1. Disable Theme Editor: To disable the Theme Editor, add the following code to your theme’s functions.php file:
define( 'DISALLOW_FILE_EDIT', true );
define( 'DISALLOW_FILE_MODS', true );

Alternatively, you can use a plugin such as “Disable Theme and Plugin Editors” to disable both the Theme Editor and Plugin Editor with a single click.

By disabling the Theme Editor and Plugin Editor in the WordPress admin panel, you can enhance the security of your WordPress site and prevent unauthorized users from accessing and editing the code of your themes and plugins.

A
Author

Author at The Creative Coders.

The monthly build log

One email a month. New posts, lessons, and the occasional strong opinion. No spam.