You can see here a list of roles and capabilities, if you want to check if the user has a certain role, you can:
$the_user = wp_get_current_user();//we get the current user
if ( in_array( 'the_name_of_your_role', (array) $the_user->roles ) ) {
//the user has the rol, add the submenu here
}
you can use current_user_can if you want to check if the user has a specific capability, like this:
if( current_user_can( 'publish_pages' ) ){
//the user has the capability do something here
}
Related Posts:
- Remove update nags for non-admins [duplicate]
- Allow Editors to edit pending posts but not draft ones
- wp_insert_user role not working
- How to target with css, admin elements according to user role level?
- Remove admin bar for subscribers
- Editor role cannot save custom theme options
- wordpress separate registration for different roles
- Display user role Name – not slug
- Add user settings to specific roles
- How to display conditional-content if wp_nav_menu( $args ) retruns something
- How to give new users two specific user role options upon WordPress user registration
- Hiding div based on user role
- custom user role wordpress – grant guest access to edit.php without insert/update/delete
- How to target grandchild of post_parent using wp_list_pages
- Do not execute If User is login as Administrator or any Specific Role
- WordPress Quick Question . How to Get Parent Link in Submenu in My Code
- get_the_title() gets printed out twice
- Add post with approval by the admin
- How to keep the capability of users and disable Gutenberg editor in WordPress?
- Shortcode for Listing Users from Meta Value?
- Array to string conversion error in PHP 7.2 when returning user role as class
- Noindex subscriber author page
- How to use wp_nav_menu to create custom dropdown menu?
- Query for user roles
- Show login greeting above sub-menu links?
- Remove submenu item from list
- How can I call a specific file (via php) by referencing the logged-in username?
- Plugin: Front-end Editor – User role specific editable content?
- Execute PHP code only with specific user role
- Edit and delete permissions pages and posts
- How to Add a cutsom slug to my custom author role
- Execute function only for specific user roles
- Allow a user or role to view drafts and previews, but not other admin privileges?
- how to create a user rule that can only manage support tickets?
- Hide payment method based on user role AND minimum cart value
- Edit a function to take different actions based on user role
- Used a code to revoke some dashboard menus for my contributors but for some reason it’s revoked me access to the editor [closed]
- Get Child of Child Pages in custom Menu
- How to give custom roles the capability to edit one Menu instead of every Menu
- Add another role to a user when they click a button?
- Obtain wordpress user role
- How to properly create multiple conditions to redirect users roles to different pages
- Echo Option Value Based On WordPress User Role
- Display specific main Sub Nav on Woocommerce product pages
- Beyond widget side menu editing, with the php page, custom template
- Allow BBPress participant role to trash topics
- Custom user roles doesn’t apply changes
- How I can add div to menu?
- wp_nav_menu prints children with parent name
- Include administrator in author list
- How to connect database table to each registered wordpress user.
- Get author meta of all writers
- Can’t remove menu items added by plugin
- Submenu opened problem
- Switch-Case and user_role
- Forbid certain users to access a specific page
- How to lock users account until approvation
- How to create a User Role and give permission to only use Web Stories plugin?
- How to create custom user role without plugin?
- Custom Admin Menu Report for Specific User ID
- How to add custom user role into wordpress
- Query both first_name and last_name from wp_usermeta at the same time
- PHP – redirect https to http and www to non-www
- Action ‘save_post’ not working for quick edit
- Audio Player not loading when the content is loaded through Ajax, MediaElement.js no applied
- Notice: Constant already defined in wp-config.php on (non-existent) line?
- Limiting the WordPress feed to only a certain limit of characters
- Sort registered users by post count? (inside admin dashboard)
- OrderItem get_total() returns lower value than $order_item->get_product()->get_price() * quantity
- Put CSS inside a PHP file and include it the right way
- Query all posts of a custom taxonomy term
- Add_action not working in required file of functions.php
- WordPress: get recent posts, delete the current category
- How to abort saving data in save_extra_profile_fields function WordPress?
- Slick + PHP + ACF + JQuery slide reveal not working
- Using Select HTML in Bootstrap Popovers
- Building a WordPress App
- WordPress Options Page Theory Question
- Help getting previously visited pages ID
- Any ideas why I am getting “I’m getting “wp-admin/admin-ajax.php 401 (Unauthorized)”
- How do I remove duplicate users from two merged WP_User_Query objects?
- How to refresh a page from jquery [closed]
- Pagination Not Working (pages duplicating content)
- Help with accessing wp-admin page and resolving error messages
- Woocommerce append shipping method form
- using shortcodes inside gravity forms
- WordPress template file if else issue
- Trying to update Woocommerce meta values
- ssl redirect function is not working
- Hide specific shipping methode depending on day and time of day
- Create “blank” admin page without having admin-bar/admin-menu for faster load
- Export WordPress User Meta to CSV/Excel
- in_array() says array is a bool?
- Permalink like example.com/taxonomy/post_type/postname
- adding or removing endforeach; throws error!
- New term taxonomy and description in front page. Input’s
- Full search and replace isn’t enough to make all pictures to be loaded with https
- How to list categories by page id in wordpress
- Passing multiple variables through url (php)
- Cannot install plugins or themes on new WordPress installation at Cloudways