I have a plugin with the following hierarchy:

  • [plugin root]
    • plugin.php
    • readme.txt
    • [subfolder]
      • plugin.js
      • jshandler.php

When I visit the Plugin -> Editor, the jshandler.php file is listed (along with 20 others). How can I only show root-level files in the plugin editor screen?


I am not sure you can do that, however, you can turn off/on the editor for plugins or themes using the following in wp-config.php

define('DISALLOW_FILE_EDIT', true );

This will hide the editor in the WordPress admin section.

Remember, this setting is controlled by the site administrator, and it is up to him/her to show/hide the editor, so you do not have control over it.

Also remember, even if you were able to hide the files in the sub-directories, those files are installed on your clients' file systems. This means that they have full access to those files, not necessarily from within the WordPress admin section, but rather from within the file system. If you are concerned about your code being exposed, then you should fine different ways of protecting it.

  • Thanks for your response. It's more for keeping things visually clean.
    – unifiedac
    Apr 20 '17 at 21:08
  • I do not think you should worry about that stuff then. All you have to do is ensure your code is clean, and correct.
    – Greeso
    Apr 20 '17 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.