This should be easiest way, just add the line to wp-config.php, this will disable plugin and theme editor, both.
define('DISALLOW_FILE_EDIT',true);
If you want to add codes into theme’s function, the code should work for you.
function ra_block_tp_edit( $caps, $cap ) {
if($cap == 'edit_plugins' )
$caps[] = 'do_not_allow';
return $caps;
}
add_filter( 'map_meta_cap', 'ra_block_tp_edit', 10, 3 );
Best of luck.
Related Posts:
- Remove specific administrator’s capability
- See which user role / capability is needed to use a plugin
- How to prevent a post from being deleted?
- How can I modify the Capability needed to access a plugin’s options?
- WordPress Capabilities: edit_user vs edit_users
- Allowing Custom Capability to Manage Plugin Options
- WordPress roles – Protect administrator role
- Advanced Custom Fields/User Role Editor – how to hide ACF for certain users?
- How create a role with admin capability less 1 or 2?
- Update User Role
- Hook to plugins admin settings
- How to allow an editor to edit all WordPress blog posts but have the last say as administrator?
- How to set add question capability for author role in wp pro quiz plugin
- Is there any way to make myself an admin?
- WordPress permissions error with admin account
- Plugin permissions for Editor role
- How To Create A File Archive in WordPress?
- Adding plugin editing capability for Author
- Remove dashboard links from wordpress
- Disable plugin for administrator
- Why user profile update creates Additional Capabilities
- Wordress admin page is fetching error You do not have sufficient permissions to access this page.
- Admin page and admin menu. Permissions plugin
- Run only on plug-in activation instead of wp_head
- Defined user role to access plugin’s pages
- Want to add post to user dashboard
- Sync roles across several plugins
- How to give access to the particular page in wordpress for specific username/email NOT roles [closed]
- How to disable plugin capability : “create new category”
- edit slider plugin capability for custom_role
- Prompted for FTP details even with FS_DIRECT set to true
- How to check if user is in back end?
- How do i know the current post type when on post.php in admin?
- Is there a way (plugin?) to restrict a user to being able to edit just one page?
- Deactivate plugin for a specific user group
- Publish author posts only with editor approval?
- Plugin or mod for wordpress to make content publication SUPER easy
- How do I only load a plugin js on it’s settings pages?
- How to add a help tab to all admin pages – including plugin pages
- Disable plugins for a specific user role
- User profiles and object associations
- How does WordPress update plugins, without running into permissions issues?
- How to develop a community feature in the dashboard for multiauthor site
- Can’t use /wp-json/wp/v2/plugins API endpoint even as administrator
- Dynamic homepage according to user role
- What’s the point of using WordPress’s built in admin-ajax.php?
- 403 Forbidden – You don’t have permission to access /wp-admin/admin-ajax.php on this server
- Filter or action hook to insert content on admin pages before tag
- How to check if a role has a specific capability
- Could not create directory
- How to edit/delete single row items in a table on my own menu page
- How can I restore admin capabilities?
- Change wording of admin menu item?
- Correct wp-content ownership and permissions
- Set of plugins to control the Admin UI
- What determines whether admin toolbar is shown to a logged-in user?
- Getting user roles in plugin files
- Which plugin will let me decide what users have access to on their side bar in wp-admin?
- What would be the advantages/disadvantages of remote plugin installation?
- Are User Levels Still Currently Used?
- Remove Duplicator plugin from admin menu if not an administrator
- Doubt using $wpbd->get_col for a single column
- Add a custom form on the post-new.php admin page
- how to give a user a role?
- Redirection of users away from wp-admin (but not administrators)
- Admin accounts unable to see plugins from external IP
- WordPress wp-admin/network/plugin-install
- how to access all user dashboard on fronted page [closed]
- Unable to delete custom post types, confusion around capabilities
- Add sub menu page in your plugin
- What’s causing this error? “Warning: Invalid argument”
- Why is the ‘Gutenberg’ Plugin generating an ‘Inconsistent File Permissions’ error when other Plugins, with the same permissions, do not?
- WordPress Admin Menu defining function is seperate file
- Hiding custom theme functionality using capabilities
- in source code but I can’t find it in files or plugins
- Updating WordPress plugin admin panel footer text
- Custom Login page with custom redirects for each user?
- Remove value from array within post meta ajax admin
- Mutliple users editing single document in wordspress
- Add logo to admin menu in my plugin
- Role based permission edit for plugins
- How to add an admin alert for missing plugins
- Why “Mine” is the default view when adding ‘capability_type’ in register_post_type
- Admin Custom Plugin List Files in admin Table
- Allow a page to be edited by a specific custom role
- How to create different views for different user roles?
- Multiple useres editing specified content
- How can I disable access to plugin settings in wp admin for other roles
- How to show private pages based on a user’s role?
- Get content and send to 3rd party
- SSH vs WordPress
- Allow non-admin users to access plug-in
- Different email notifications (about pending posts) to different users
- Getting 404 page not found error while trying to access add new plugin / themes
- admin panel save option with ajax
- Problem with permissions in wp-content/plugins
- What would cause edit buttons for plugins to disappear?
- Making plugin to use different table prefix cause permission problem
- registration plugin [closed]
- How might I enable a user to view Draft pages from a different Author, without the ability to edit?