You can wrap the code which you want to limit using the current_user_can() function.
if( current_user_can('editor') ) {
// true if user is an editor
}
Depending on what you are trying to limit, you can put this conditional around the hook or action that you are adding, or use it to wrap specific functionality within the plugin.
Related Posts:
- what’s the meaning of the field wp_capabilities in table wp_usermeta
- Send user activation email when programmatically creating user
- Change default admin page for specific role(s)
- Add Custom User Capabilities Before or After the Custom User Role has Been Added?
- How to Change the Entire WordPress Admin panel Look and Feel?
- How to Structure a New Role/Capability Scheme?
- How to add more than 1 user role to sub-menu pages
- How to allow Unfiltered HTML in a wordpress multisite install
- How to restrict plugin’s sub-menu pages to admin/subscribers?
- How to not let a user with a new role edit users that have administrator role?
- Execute plugin for specific user role(s) only
- query users by role
- Hide plugin dashboard menu item for specific roles
- get_posts() not working when accessing with a custom user role
- Limit role to one plugin [duplicate]
- Logout users upon login, based on caps/role?
- Set different custom menu items for different user roles
- Prevent third party plugin’s admin page access based on user type
- wp_dropdown_roles() to replace option value = code
- Hide custom post type by user roles
- Check user’s role and store in variable
- Menu page with minimum capability as ‘Subscriber’ doesn’t allow ‘Admin’ to access it?
- How can I change my assigned user role in WordPress 3.5.1?
- How to determine which capability to use?
- Allow contributor user role to perform copy operation PHP
- Enable a role named ‘backend_user’ to access my plugin pages
- Add custom parameter for custom user role
- Buddy Press restrict the capability to edit users
- Remove all capabilities in separate method fails versus included in method
- Remove from a div by class name from post page if post author role is not administrator
- Adding admin for specific users
- What is more secure checking capabilities of user or checking role of user in WordPress plugin development
- New Users are saved with no role selected
- WordPress User Management Departmental Managers
- Remove default wordpress roles
- How to debug a plugin with Xdebug?
- Is there widely accepted phpDoc syntax for documenting which hook calls a function?
- Make Categories and Tags required in admin
- Getting wrong relationship value in $args in wp_Query?
- How to extend LINK TO functionality in ATTACHMENT DISPLAY SETTINGS
- How to iterate through custom posts and add the title to an array
- How to create Image gallery Metabox in wordpress [closed]
- Is it possible to create an action hook using do_action() within add_action()?
- Custom user profile, registration, login page with theme
- Plugin Sidebar is not Saving Meta Attribute to Post/Page after “Update”
- WordPress 2.8 Widget API is suitable for Worpress 3.1.4 plugins development?
- Need specific kind of “Poll Voting” for WordPress [closed]
- Install widget on plugin activation
- Plugin admin page meta_box toggle and order state not saving
- Is there a better way to implement responsive images than what WordPress uses by default?
- Prevent Javascript Facebook SDK Conflicts in plugin
- Integrating Stripe PHP library into a custom WordPress Plugin
- How to change the URL pattern for single post view
- What for the tables ending with the meta used in database of wordpress?
- Use WP_Theme::scandir function to scan a plugin directory. Is there a way?
- Plugin options not being saved or created
- Change the ‘published on’ text?
- WordPress is automatically linking plain text email addresses
- How to get boolean value from register_meta properly?
- Gravity Forms Perks – Nested Forms
- Remove custom post type slug from URL and add taxonomy Slug
- How do I get the sub categories of the parent when in a sub category?
- custom permalink’s rewrite rule for page id
- how to get context information inside my funcion
- Is disabling test_form in wp_handle_upload a security concern?
- Update custom plugin with WP-CLI
- Delete data from database using row action
- Update wordpress Core Remotely
- Proper way to use useSelect
- How to create templates for a custom module to show on the front end within my theme?
- WordPress: Custom User Role cannot access Custom Post Type | “Sorry, you are not allowed to access this page”
- Access to apache logs from plugin
- Two different wordpress sites – same server and IP address. Gaining Access to database 1 of 2
- Translating plugin settings page – dropdown list
- Hide one specific woocoomerce product
- settings api – add_settings_section not working
- Remove Meta-boxes (Yoast SEO plugin) [duplicate]
- Can I use a custom post type as a custom taxonomy for a different custom post type?
- WooCommerce currency converter support [closed]
- Woocommerce – looping product images
- wp_schedule_single_event is set correctly but sometimes not fired
- wp.media gallery collection sometimes undefined
- Pass Values in URL on WooCommerce Product Page
- Plugin Install Issue “-1” Appended to end of plugin name
- $ is not defined [duplicate]
- Can’t upload image via submitting custom post from frontend
- Add a custom submenu under submenu in a Custom WordPress Plugin
- Custom Plugin activation error in Multisite
- Redirect theme directory to plugin theme directory
- Front End users account with lots of user Roles (not Woocommerce)
- How do WordPress plugins work with oAuth2 APIs?
- Translation not working for Constant strings in Plugin
- problem with blank page
- Cannot echo a JS variable to a jQuery plugin coming from wp_localize_script
- first_name property missing inside register_user action hook
- How do I use (or mimic) document.getElementById() on a page loaded from WordPress database?
- How to get the value entered in the input field in wordpres
- Sanitize and Save metabox values
- How can I add a custom button to the post editor?
- How to use register_setting()