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
- If the current user is an administrator or editor
- Find out if logged in user is not subscriber
- Groups of capabilities: users with multiple roles?
- How to restrict access to uploaded files?
- Execute a function when admin changes the user role
- What the user_status column?
- Allowing an email as the username?
- 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
- How to enable the theme editor cap for an editor role?
- 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”?
- How do I properly format the user_role array?
- Is there a simple way to manage capabilities per user?
- Redirect after login based on user role (custom login page)
- Tagging users in WordPress
- Redirect after users complete profile form
- Cannot set user passwords
- Share user table from WP with Drupal
- Log all users out of all locations after 24 hours
- add_cap not working with Shop Manager role
- How do I customize the dashboard?
- Creating user relationships
- How to show a gloabl message on a user profile page (in back end)?
- Is there a way to make custom fields only editable by administrators?
- User capability for editing their own comments
- Editable registration date field in user profile
- Allow Contributors to Upload Files
- Add a role and give admin priviledges
- User profile updates password even if not filled (Theme my login) in Firefox? [closed]
- Create custom post with custom user rules
- How to Create a User Profile Page?
- Prevent subscribers to changing certain profile fields
- How many people are allowed to use same wordpress account at the same time?
- Restrict access to non-wordpress section of site with user roles?
- What’s the correct way to add capabilites to user roles?
- User roles not displaying
- Does it matter if the very first user, usually Admin, does not have a user ID of 1?
- How to hide some users to unlogged users [closed]
- List all users and current week entries
- Groups and subgroups for permission
- Redirect admin 403 “Cheatin uh?” admin pages
- User can manage one page accessible by everyone?
- Extending the user profile [closed]
- User can’t search himself on rest api
- How do I update user email from frontend input field?
- How to hide “Change role to” dropdown on Users admin menu
- how to create user profile pages and display them based on users roles
- How can i display pagination in custom comment list?
- hide page menu from admin panel for specific users
- How can i add user display name drop down menu in frontend?
- How to create page for user?
- How to Moderate Edits to User Profiles?
- Create relationships between users or user roles
- User Permissions on custom post type
- update custom field user profile from front end form
- throttle/limit a logged in user’s http requests to specific page on a per day basis
- Showing extra profile fields in admin – problem with underscore
- Add an ‘edit profile’ page with Genesis
- How to create a link to a user’s profile page
- Creating Custom user type just like custom post
- Validate user meta and redirect
- Storing additional information about the user
- What techniques can a user employ to achieve a password rated “strong” in the WordPress password checker
- current_user_can() returning true for capability when the user and role do not have the capability
- Cant edit profile from frontend
- WordPress password as plain text in email
- Redirect Login Based on User Role