Sometimes, it is enough just to hide a link from the admin menu and thus, deny access to a specific edit page. But if you only hide a certain link, the page which the link leads to will still be accessible to anyone who knows the correct path to the file. Since many users will stay with the default setup, it is easy to find that path.
Consider hiding the menu link only if you want to make the menu less crowded and simply exclude the possibility of accidental access to the pages.
When it comes to admin access, probably the most damage can come from file editor which is by default included for all themes and plugins. While the editor is a great tool which can help you quickly view core files and functions and even make some minor changes to the code, it can be a tool of destruction if left for unexperienced users. Only one wrongly placed character can take down your entire site so this is definitely something not to mess with.
Because editors in WordPress are quite sensitive to changes, it is best to completely remove them for users. In this article, we’re about to show you a very simple method of removing pages, as well links to those pages.
IMPORTANT NOTICE: Before you proceed with making changes to your functions.php file, you should know that disabling editor pages might make your themes or plugins out of order. This depends on each theme and plugin itself, so be sure to check your theme and plugins to see if everything is working correctly.
Now that you’re aware of the risk, you can continue with implementing the code.
Deny access to Themes and Plugins edit page:
- Open functions.php file from your editor for the last time
- Copy and paste the code:
- Save changes
- Don’t freak out about the message – you have just restricted yourself from accessing the editor.
- Simply navigate back to your site admin and notice how links to editors have disappeared
Now you have successfully removed Theme and Plugin edit page which can’t be accessed through WordPress anymore. In order to change those files, you will have to use a different approach and use an FTP client, for example.
If you need further customization, you can easily hide a plugin from the list.