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
- WordPress Create New Role Just to Manage Users?
- child category under correct parent
- Hide ID for WordPress User Role Subscriber
- WordPress and event-driven programming – what is it about?
- How WordPress encrypt password? [duplicate]
- Adding a custom image upload size and making it selected by default?
- Conditionally loading JavaScript based on the Advanced Custom Fields in the post
- Limit the Excerpt field in WP-Admin in words
- How to change / delete product short description in Woocommerce
- How do I show the featured images for my child pages on my parent pages?
- WP_Query loop, does not display special characters in title correctly
- Remove query string specific key value
- How do I get current page ID in WordPress customizer file?
- WordPress Ignoring .user.ini
- Cron events are disappearing, or cannot be updated in WordPress
- Prev/Next child navigation for current page modifications?
- Show success or error messages in Ajax response to WordPress custom registration form
- Site downloads files instead of loading them
- Saving data from custom form in wordpress database
- Logout redirects to default page
- Multidimensional Array
- Php code error in wordpress if else statements [closed]
- Get the list of post categories
- Wrap title and excerpt in a div (latest posts block)
- How to access all meta data for RSS feed?
- Why Is Number of views on wordpress single post wrong?
- Change extension to .jpg when webp is not supported
- add another variable to php function
- How to remove get_header From all single pages in wordpress with functions.php without plugin?
- Remove generated category and tag class names from woocommerce product & blog listings markup
- Encoding video without exec function
- wordpress query returning unexpected results
- redirect 301 with special character like WIX site “#!”
- How to print redirected query string variables to the page?
- Admin-area broken through weird issues
- Display a query with multiple post types and same relationship on a single page
- Get string from array and start loop [closed]
- wp_link_pages return value even when is condition inside if statement
- How to quickly/easily make an analysis (reverse engineering) of WordPress?