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?
- 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)?
- Make display name unique
- How to let contributors to create a new revision(draft) editing their published posts
- Show admin bar only for some USERS roles
- How to manually activate user in dashboard only by admin
- How to check user role without using current_user_can()
- \WP_User Object | What’s the Difference Between {caps} and {allcaps}?
- How to assign capabilities to user NOT to User Role
- Upload gravatar in WP profile?
- How to stop a user from updating the post date
- BuddyPress | Check if user is in current group [closed]
- 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 to get the Role Name of the current user? (WordPress)
- set_role has no effect
- Drop down list in user profile page
- WP_User->add_role producing unexpected results
- Custom style on profile options page
- How do I list in the backend all users that were assigned to a custom role?
- Get User Role by ID not working
- how to make a profile entry read only except for site managers [closed]
- Upgrade Nightmare – No Posts, Permissions Issues and Can’t Create a new post
- Are User Levels Still Currently Used?
- How to add a user profile page to frontend?
- Error: How to allow the “contributor” to upload media in wordpress
- Restrict access of admin uploads to certain logged-in users?
- Fix permissions for users role
- Reset Password policy
- Is possible to allow user to login with different role?
- How change user type from contributor to author
- How do I let contributors edit their posts after being approved once?
- Does wordpress support natively the concept of logging-in users? (not admins, but users of the website)
- Create a “user log”
- Fix ‘Add Role’ Option not there in wordpress 5.2.2
- Allow Users to Modify Some Values of Assigned WordPress Pods [closed]
- Unique password to access a section site
- redirect user to their profile after log in
- Given multiple admin accounts, how can I make it so that only admin with X username can edit posts
- One Click Access To Users Account In WordPress?
- Editor role can only create/edit/delete users who have one of two roles
- How to add extra field in profile page and show in myaccount?
- WordPress 5.8 – Hide or Remove personal fields from admin Profile page
- I need a link that directs the user that is logged to his profile
- Find count of WordPress users by role and search string for user name
- fine-grained capabilities for user related capabilities
- Updated user role inncorrect when using wp_get_current_user()
- How to use url formatter with integer
- In admin manage users page, how can I stop users with certain privileges from editing users with other privileges?
- Show user details only
- Require confirmation of current user’s email before updating database and before send_email_change_email
- Access level seems to have gone from admin to editor
- post acces for guests / unregistered users only
- Edit dashboard based on user ID
- Manage user profiles with WordPress
- Front end login and page restriction
- Limit roles displayed in users.php depending on custom role
- Fetching posts that match a User Profile setting
- Designing a member area on my site
- view and update form only for registered users
- Modify Profile Biographical Info Field
- i need to let a user to add a role from a frontend form
- file upload user profile
- How to give different user access to different people?
- Show only users with the same role in Dashboard user list
- Wordpres password as plain text in email
- WordPress: New user role which is ONLY allowed to manage media
- Can we get user profile page using user_id in the URL?