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
- Groups of capabilities: users with multiple roles?
- WP_User_Query and non-unique usermeta data
- Loading posts associated only to the logged in user on recent posts page
- How can i force Display names to be the same as Usernames?
- How to enable the theme editor cap for an editor role?
- How to create custom LOGIN and REGISTRATION forms?
- Change destination author link
- $current_user var returns NULL
- Multisite functions to communicate with individual site functions
- Remove Adminstrator Hyperlink from a user having role to add and see users
- Enable comments for post with comments meta box removed
- Restrict backend but allow to use post.php?action=delete&post=POSTID from front-end
- Is there a simple way to manage capabilities per user?
- How can I change plugin to give access to editor user role?
- wordpress custom login successful redirect hook
- Current user in plugin returns NULL
- Plugin to restrict access to pages in wp-admin
- How to upload user profile image from frontend in wordpress ?
- Average Account Age
- How to write a plugin to add users to a mail list
- How to keep users unique id stored in session in addition to IP in WordPress plugin?
- Hook to plugins admin settings
- New User Form – Custom Menu Page
- Roles for Custom Post Types
- Making a plugin only available on the front-end for the logged in super admin
- Filter custom posts based on the user role of author
- How to allow an editor to edit all WordPress blog posts but have the last say as administrator?
- Modifying Author Link to add Author Meta in URL
- Add a role and give admin priviledges
- Can a Plugin Override New User Default Role Type
- Can I allow certain people to add/edit pages within a parent?
- can i limit editing specific custom fields to certain roles?
- How can I prevent certain custom roles from seeing other custom roles on the user list page?
- Allow only Admin role to access plugin settings/options page
- Select other roles as custom post authors
- What’s the correct way to add capabilites to user roles?
- Show WordPress Plugin Menu(Admin) To Editor
- same user role or copy the user role to be same as the other role
- Can’t save changes or modify settings in Dashboard but Pages and Posts are fine
- Allow a user or role to view drafts and previews, but not other admin privileges?
- How to display ACF coustom field from category on author.php
- How to implement data residency in my WordPress site
- Need help with Task assigning and rewarding as currency which withdrawable
- Allow editor user to full permission to access plugin settings
- User updating their profile wipes my custom fields
- Comment restrictions Wodpress
- How to make this custom capability work? [duplicate]
- Co-author plus: list of posts by authors in the sidebar
- Public WP website with one area just for members
- Disabling user capability to edit_posts or delete_posts in the front-end
- Restrict role to use a plugin
- How to see in Edit Comments if comment is from User and her Roles
- How can I save cookies to members
- Every time I use wp_get_current_user() my plugin breaks
- Users Ultra: Hide asterisk for required registration fields?
- Hide some portion on single.php base on author
- Custom User Role
- How to set different users for different pages?
- Allow a role to edit one specific plugin
- WordPress Role Capability Restriction
- Make plugin admin page visible to other roles
- Issues with creating user profile for a subscriber, but with different profile page and functionalities