Use the function current_user_can( $capability )
. Where $capabilty applies.
For example:
If ( current_user_can( 'update_plugins' ){
//do some update plugin stuff
}
Related Posts:
- Set default page for user account in admin
- Allowing users to edit only their page and nobody else’s
- alphabetically order role drop-down selection in dashboard
- Disallowing Users of a Custom Role from Deleting or Adding Administrators?
- Hide Admin Menu for Specific User ID who has administrator Role
- How to customize wp_signon()
- Can I create users that have access to *some* other users posts instead of all other users posts?
- How to add local users to wordpress without email password?
- Hide everything on site for visitors except specific page IDs
- Managing Users and Creating Groups [closed]
- How to disable a specific page for a specific user
- Allow user access to Dashboard only!
- wordpress user roles are not working
- Displaying different in-page content to cliente/admin
- Problem with automatic role change through cron job
- How can I allow an User to publish only 5 posts per month?
- Where are $current_user->allcaps set?
- How to hide user profile fields based on the role of the viewed user?
- Allow admins to login as other users
- Can I Create a Second Admin Level User Role?
- How do I modify the user role ‘subscriber’ to allow the user to delete posts
- WordPress user role with create user capability?
- Update user role for expired membership
- Custom User Role: Can Edit Own Page, Cannot Create New
- WordPress install checking permissions of user id 0
- Allowing users to edit only their page and nobody else’s
- How to bulk change user role to “No role for this site”
- Control Category of each user can post
- How to create front-end (editable) WordPress user profile pages?
- Limit user access to installing/configuring a plugin?
- How to remove/limit Editor accounts privileges, to prevent them from deleting media and pages created by Admin
- How to add default folders to Every registered User when registered in WordPress site?
- If the current user is an administrator or editor
- Editor can create any new user except administrator
- How to allow an user role to create a new user under a role which lower than his level only?
- How to programatically change username (user_login)?
- Remove Ability for Other Users to View Administrator in User List?
- Make display name unique
- Find out if logged in user is not subscriber
- Groups of capabilities: users with multiple roles?
- User-edit role setting distinct from wp_capabilities? [closed]
- How to restrict access to uploaded files?
- Execute a function when admin changes the user role
- How to let contributors to create a new revision(draft) editing their published posts
- What the user_status column?
- How to hide media uploads by other users in the Media menu?
- Show admin bar only for some USERS roles
- Allowing an email as the username?
- Grouping users under parent user
- Check if specific username is logged in
- How to update user role without logout
- How to manually activate user in dashboard only by admin
- How to check user role without using current_user_can()
- How to create a public profile for authors/contributors/users?
- Post list based on the user that is logged in
- Basic auth WordPress REST API dilemma
- Do not allow users to create new posts and pages
- \WP_User Object | What’s the Difference Between {caps} and {allcaps}?
- Force users to complete their profile after they register? How to
- How to enable the theme editor cap for an editor role?
- How to assign capabilities to user NOT to User Role
- Upload gravatar in WP profile?
- How to assign an additional/extra/second user-role to multiple users (of a specific user-role)
- How to stop a user from updating the post date
- BuddyPress | Check if user is in current group [closed]
- Copy a user from one WordPress site to another
- How to remove “Super Admin” from All Users for those that are not a “Super Admin”?
- Return ID of authors who have at least one post
- WordPress edit_user_profile_update update secondary role
- Front end user meta options for users
- How do I properly format the user_role array?
- How-to Delay The Capability To Publish Posts?
- add ‘file upload’ field to user details
- Completely hide user info
- Is there a simple way to manage capabilities per user?
- Is it possible to get a user with just the password field?
- How to get the Role Name of the current user? (WordPress)
- Redirect after login based on user role (custom login page)
- set_role has no effect
- Drop down list in user profile page
- WP_User->add_role producing unexpected results
- How can I check if the admin bar is visible to the current user?
- Custom style on profile options page
- Users roles, make a page belonging to multiple users
- Tagging users in WordPress
- Redirect after users complete profile form
- Add custom fields to the user profile
- Cannot set user passwords
- Share user table from WP with Drupal
- How do I list in the backend all users that were assigned to a custom role?
- Is there any function available to echo current user’s profile url?
- Log all users out of all locations after 24 hours
- Get User Role by ID not working
- Disable user profile editing for one user
- the_author_meta(‘user_url’, $author->ID) not working properly. how can I solve this?
- Getting users by specific capability, not role
- add_cap not working with Shop Manager role
- How do I customize the dashboard?
- Creating user relationships
- how to make a profile entry read only except for site managers [closed]