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
- coauthors_plus_edit_authors to display metabox based on author caps
- How to create user that has permission to create new sites on WordPress with multisite option enabled?
- Updating plugins asks for FTP information, why? (this is a new one)
- do_action() hook into load-(page)
- Lock access to plugin options
- How to change the name of the “edit my profile” link in the WordPress admin backend
- Unable to delete custom post types, confusion around capabilities
- WordPress Remove Submenus
- User / membership Plugin [closed]
- Restrict role to use a plugin
- Add_Meta_box to custom page (formidable edit post)
- How can I create multiple different admin roles with their own capabilities
- WordPress Plugin Install / Update Problem
- Database error when user logs in
- WordPress FTP/media directory permissions problem?
- Get content and send to 3rd party
- Overwrite user role
- How to enable Admins to see Plugins
- Force “submit for review” on update?
- SSH vs WordPress
- Allow non-admin users to access plug-in
- Images not showing on homepage after migration [duplicate]
- Different email notifications (about pending posts) to different users
- Add a checkbox in plugin options page and make it actually work
- Embedding code snippets in posts with indentation
- Hide some portion on single.php base on author
- page creator to leave comments ONLY
- Plugins not activated after update?
- Editor have not permissions for a plugin
- Custom User Role
- Getting 404 page not found error while trying to access add new plugin / themes
- Create a blank admin page from plugin
- WordPress Permission Problems on Ubuntu 12.04 with LAMP stack
- Plugin not installing properly, functions being redeclared
- admin panel save option with ajax
- Custom Form only for admin
- how to call jQuery in admin as well as in homepage
- Problem with permissions in wp-content/plugins
- What would cause edit buttons for plugins to disappear?
- WordPress plugins not showing after switching servers
- Making plugin to use different table prefix cause permission problem
- Adding hero images to blog posts
- How to create plugin list groups?
- Allow a role to edit one specific plugin
- Frontpage Admin Bar Disappeared
- What is the recommended way to be notified of security updates to my plugins? [closed]
- WordPress Role Capability Restriction
- Zigconnect Plugin: Allowing editors to remove connections
- Why plugin’s icon for the menu not found?
- Need help with restricted page for users
- Two sites one PC
- How to give different user access to different people?
- registration plugin [closed]
- current_user_can() returning true for capability when the user and role do not have the capability
- Allow direct access to files/folders within WordPress to replace wp-admin
- Gravity Forms and Gravity View Permissions
- How might I enable a user to view Draft pages from a different Author, without the ability to edit?
- Make plugin admin page visible to other roles
- Display Any Field fromAdmin Panel in Frontend via Shortcode?
- How to have certain products show for only certain users (Not roles)
- Show the author only own types of publications. (JetEngine, Elementor)
- Only an admin can add new tags
- Show different page depending on user role
- What plugin presents these extra columns in wp-admin -> plugins
- How can I hide Dashboard notifications for just one particular plugin?
- How to create WordPress login for different users, with different roles?
- How to disallow users to edit other’s posts for a new custom post type?
- Remove 3rd party plugin notices from within own plugin
- Show only those pages that are created by the specific logged in user in WordPress
- How is wp_admin_notice supposed to work?