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
- Remove Ability for Other Users to View Administrator in User List?
- Groups of capabilities: users with multiple roles?
- WP_User_Query and non-unique usermeta data
- How to enable the theme editor cap for an editor role?
- Woocommerce: change user role after completing order
- How-to Delay The Capability To Publish Posts?
- $current_user var returns NULL
- Show different badge based upon the user role
- Remove Adminstrator Hyperlink from a user having role to add and see users
- Enable comments for post with comments meta box removed
- Checking for user role in a custom plugin
- wordpress custom login successful redirect hook
- User role permissions based on taxonomies
- How to show popup to a group of users?
- update_user_meta add value on the top on existing value
- the_author_meta(‘user_url’, $author->ID) not working properly. how can I solve this?
- Plugin to restrict access to pages in wp-admin
- New User Form – Custom Menu Page
- Roles for Custom Post Types
- Modifying Author Link to add Author Meta in URL
- WooCommerce specifc variations for specific user role [closed]
- Add a role and give admin priviledges
- How to restrict author to only access one custom post type ?
- Custom User meta field display
- Co-Authors Plugin Displaying Wrong Author
- Unable to delete custom post types, confusion around capabilities
- Change get_current_user_id code to the author’s profile
- Show author on every sub-page
- How to create multiple users at once?
- Shortcode to update user meta
- How do I get the user ID of the user that was updated in WordPress?
- how can I query all wordpress users of a blog
- Add Content to Content()
- get_users(); Is an Undefined Function When Used in Cron Job
- Woocommerce: limit user to see only the products he created
- OceanWP settings are missing from Add New Post [closed]
- how to add custom info on author page? plugin, child theme?
- Individual Comment Notification Setting For Post Author
- Plugin access and Roles
- Auto populate a user custom field from another user custom field
- Show an admin menu item in Editor role
- co-authors plugin – inline listing
- Display Author name PHP (Selfmade Plug-IN)
- Allow a particular user to access a particular plugin?
- Allow a page to be edited by a specific custom role
- How to create different views for different user roles?
- How To Export User’s Custom Fields in CSV or XLSX
- Get all user meta_keys and then group users by matching values
- fine-grained capabilities for user related capabilities
- Changing author slug for a custom role without using plugin
- How can I disable access to plugin settings in wp admin for other roles
- Searchable Semi Random Number Generator on User Profiles
- How can I store user preferences in WordPress and retreive them later?
- Subscriber role – blank page
- Convert usernames listed by the Groups plugin shortcode to displayed names?
- Displaying custom profile fields using Mingle Plugin
- User register hook can’t access form request
- registration plugin [closed]
- Make plugin admin page visible to other roles
- Issues with creating user profile for a subscriber, but with different profile page and functionalities
- Show different page depending on user role
- Email notification when registred user clicks a link/visits page