Please update the code as below
add_action( 'admin_menu', 'remove_menus' );
function remove_menus(){
$user = wp_get_current_user();
$role = ( array ) $user->roles;
if($role[0]==subscriber)
add_menu_page( 'edit.php' ); //dashboard
}
Related Posts:
- Remove specific administrator’s capability
- Adding plugin editing capability for Author
- Remove dashboard links from wordpress
- Publish author posts only with editor approval?
- How to let contributors to create a new revision(draft) editing their published posts
- 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
- How can I let users to access plugin functions based on roles?
- Update User Role
- Getting user roles in plugin files
- Custom post type – no layout section of Document tab, and no author choice
- How to create restrict content to users (by user, not by role)
- How to set add question capability for author role in wp pro quiz plugin
- Multisite – maximum number of users with specific role
- Understanding State in WordPress Multisites
- Add User Role: Pre-saved in User-Meta [SOLVED]
- Custom Login page with custom redirects for each user?
- Mutliple users editing single document in wordspress
- Plugin permissions for Editor role
- Personalized Author Area
- How To Create A File Archive in WordPress?
- Completely remove ability to create users?
- Role based permission edit for plugins
- Creating teams of users in WordPress
- How to hide plugin options for editors via functions.php
- Plugin privelages for “editors”
- See which user role / capability is needed to use a plugin
- how to create user profile pages and display them based on users roles
- User / membership Plugin [closed]
- Why user profile update creates Additional Capabilities
- Run only on plug-in activation instead of wp_head
- Defined user role to access plugin’s pages
- Sync roles across several plugins
- How to give different user access to different people?
- 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
- Changing author slug for a custom role without using plugin
- Multiple useres editing specified content
- On button click, redirect users to registration page instead of another page
- How can I disable access to plugin settings in wp admin for other roles
- Searchable Semi Random Number Generator on User Profiles
- How do I run my custom function in my plugin when a wordpress user is deleted?
- How to show private pages based on a user’s role?
- Disabling user capability to edit_posts or delete_posts in the front-end
- How can I store user preferences in WordPress and retreive them later?
- Simulate Update User button click
- Disable plugin for administrator
- How do I restrict a second admin certain access?
- Update User Meta Via Ajax
- User Following System
- How to get the total count of Favorite/Favorited authors
- Restrict role to use a plugin
- How to see in Edit Comments if comment is from User and her Roles
- how to show Author group not Author name
- Custom User Notice Upon Login
- Groups roles & capabilities
- A different role for each site in a multisite
- How can I save cookies to members
- Paid Memberships Pro, Display User Limit
- How to prevent authors from editing their post count?
- Overwrite user role
- Confusing problem with displaying message recipient metadata
- Every time I use wp_get_current_user() my plugin breaks
- How to order users alphabetically by name? in plugin UPME
- Displaying friend’s posts only
- Users Ultra: Hide asterisk for required registration fields?
- Allow non-admin users to access plug-in
- Subscriber role – blank page
- Different email notifications (about pending posts) to different users
- Hide some portion on single.php base on author
- Custom User Role
- Author capabilities: Deleting comments on their own published posts
- How change menu for each user in plugin?
- How to show author’s avatar in the post meta data with plugin `user-avatar`
- Unfortunately removed myself as plugin committer
- How to set different users for different pages?
- Convert usernames listed by the Groups plugin shortcode to displayed names?
- Displaying custom profile fields using Mingle Plugin
- Check if post was modified by editor different than post author
- Allow a role to edit one specific plugin
- WordPress Role Capability Restriction
- Zigconnect Plugin: Allowing editors to remove connections
- WordPress User Portal
- User register hook can’t access form request
- How to make wordpress backend mobile optimized.?
- registration plugin [closed]
- how to embed a crop feature for cropping images uploaded by the user
- current_user_can() returning true for capability when the user and role do not have the capability
- Share or sync user table data with another user table
- Make plugin admin page visible to other roles
- Issues with creating user profile for a subscriber, but with different profile page and functionalities
- How to have certain products show for only certain users (Not roles)
- Show the author only own types of publications. (JetEngine, Elementor)
- Show different page depending on user role
- Email notification when registred user clicks a link/visits page
- Is there a plugin or resource for custom implementation for OAUTH and regular user login?
- How to create WordPress login for different users, with different roles?