Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [user-roles]

Names for a set of user capabilities.

Filter by
Sorted by
Tagged with
167 votes
6 answers
420k views

If the current user is an administrator or editor

How can I check to see if the current logged-in user is an administrator or an editor? I know how to do each individually: <?php if(current_user_can('editor')) { ?> <!-- Stuff here for ...
andy's user avatar
  • 2,359
104 votes
7 answers
278k views

How to check if a user is in a specific role?

I have a pretty specific requirement to show different text in a field label on the user profile page based on the current user's role. I can't seem to figure out how to check whether the current use ...
jessegavin's user avatar
  • 3,456
55 votes
7 answers
85k views

allow editors to edit menus?

I would like to be able to grant my editors the power to change the menu, can this be done? The appearance tab doesn't appear to be an option at all, can I make it so?
Mild Fuzz's user avatar
  • 4,180
54 votes
9 answers
127k views

How to change a user's role?

I have custom roles in my setup and I want to be able to automatically change a user's role thru a function. Say user A has a SUBSCRIBER role, how do I change it to EDITOR? When adding a role we just: ...
Joann's user avatar
  • 1,485
49 votes
6 answers
57k views

Getting a List of Currently Available Roles on a WordPress Site?

When writing WordPress plugins there is often a need to set up options for which roles on the site have access to certain functionality or content. To do this a plugin dev needs to fetch the list of ...
jerclarke's user avatar
  • 3,043
42 votes
4 answers
22k views

Editor can create any new user except administrator

I have set up a WordPress site for a client. The client has the Editor role, however I have installed the Members plugin and given the client the capability to add new users to the WP admin. This is ...
Vayu's user avatar
  • 519
34 votes
5 answers
67k views

Allow member to have access to custom post type only. Permission to only edit their own posts

OK I'm looking for the best way to attack this. I'm very comfortable with PHP and making custom post types with custom meta fields in WordPress. Here is what I'm looking at doing: User registers ...
Scott's user avatar
  • 12.2k
29 votes
6 answers
31k views

Is there way to rename user role name without plugin?

Is there anyway to rename a user role name via hook, instead of using plugin? Edit For example, administrator » owner
Sean Lee's user avatar
  • 1,109
28 votes
5 answers
23k views

How to create a clone role in wordpress

How to create new role with same capabilities of existing role. Eg: I would like to create a new role with same capabilities of administrator or editor and so on..
Aadi's user avatar
  • 507
26 votes
2 answers
61k views

Where are available Roles Defined in the wp_ database?

I got on the list to test a private beta of a plugin I'm using on a multisite network. The plugin authors have code in there to add a custom role. They have a bug that removes the ability to give a ...
cpilko's user avatar
  • 715
25 votes
6 answers
54k views

Possible to hide Custom Post Type UI/Menu from specific User Roles?

What I'm looking to do is completely hide the UI for a custom post type from specific user roles...Ive previously found many resources on how to disable access to using those CPTs but nothing that ...
Mr.Brown's user avatar
  • 1,025
24 votes
5 answers
29k views

How can I allow the Editor Role to change Theme Settings?

I've just setup a new Blog for a friend and thought it's better to not give him Administrator Access right away as a precaution. I created a new user as Editor therefore. But then I saw that this ...
hakre's user avatar
  • 12.9k
20 votes
2 answers
11k views

How to allow an user role to create a new user under a role which lower than his level only?

I have three extra roles in my site. Doctor Receptionist Guest those roles are added by following code: * adding Doctor role */ $doctor_role = add_role('Doctor', __('Doctor'), array('read'=>'...
Riffaz Starr's user avatar
18 votes
4 answers
70k views

How can I get a list of users by their role?

How can I get a list of all users that are in WordPress by their role or capabilities? For example: Display all subscribers list in WordPress. Display all authors list in WordPress. Display all ...
Raja Usman Mehmood's user avatar
18 votes
2 answers
46k views

How to add a Capability to a User Role?

I am managing a Wordpress network and would like to add the unfiltered_html user capability to the already predefined user role of Admin. In a standard installation of Wordpress the Admin account ...
Jonnybojangles's user avatar
17 votes
1 answer
31k views

Separate registration and login for different roles

I've set 2 new roles for my site using the "Members" plugin - "sellers" and "buyers". Each role should have its own registration page and login. A visitor can register as both a buyer and a seller ...
Ash's user avatar
  • 175
16 votes
7 answers
17k views

Why are my roles not visible in a Multi-site/Network?

My network is showing roles in some sites and not in others. For some reason that I can't explain, when I add a new user, I have no roles to choose from in the drop down box of a sub-site in my ...
Geo's user avatar
  • 747
16 votes
8 answers
17k views

Select subscriber as author of post in admin panel?

I want to be able to select a subscriber an author of a post in the admin so it displays their name as having written the post, but I do not want to give them any additional privileges (if they login ...
fxfuture's user avatar
  • 1,337
16 votes
3 answers
8k views

Remove update nags for non-admins [duplicate]

I'm trying to remove or hide the update nags for non-admin users. As an admin, I see: The popular answer I've seen to handle this says to use: function hide_update_nag() { if ( !current_user_can(...
j08691's user avatar
  • 765
16 votes
3 answers
14k views

How to allow editor to edit privacy page / settings only?

In my WordPress installation (4.9.8.) the editor role isn't allowed to edit the privacy page. It would work with following in my functions.php: $role_object = get_role( 'editor' ); $role_object->...
André Kelling's user avatar
16 votes
3 answers
35k views

How to get role of user

I need to get the role associated with a user -- not the "currently logged in user". I am using Buddypress (not that should matter to the nature of this question) and I am in the bp_members() loop. ...
frank13's user avatar
  • 377
16 votes
2 answers
15k views

Give Editor Access To Sidebar

I want to give the Editor Role access to editing the sidebar and it's contents. I have a text widget in there and in order to edit this text widget the user needs to be an admin - this sucks. How do I ...
Howdy_McGee's user avatar
  • 20.7k
16 votes
5 answers
10k views

Site admin in a network install can't edit users?

For the Stack Exchange Community Blogs, we have a network install that we've set up. I am being told that the site administrator role is not allowing an option for user editing. On the site's users ...
Rebecca Chernoff's user avatar
15 votes
4 answers
16k views

Remove Ability for Other Users to View Administrator in User List?

(Moderator's note: Original title was "Remove Admin from User Menu") I have created a client administrator role which is essentially an Editor with ability to add/remove users. The article "Editor ...
Carlos's user avatar
  • 153
14 votes
3 answers
21k views

Reset default roles and capabilities

I've been having a difficult time adding custom post type capabilities to roles (Adding capabilities to default roles) and I suspect that my muddling around may have caused some problems. I also have ...
mantis's user avatar
  • 780
14 votes
4 answers
34k views

How do I programmatically set default role for new users?

I would like new users of the blog to have custom role, rather then Subscriber. How do I set this programmatically? I know that it can be changed from the backend.
jayarjo's user avatar
  • 518
14 votes
5 answers
16k views

How do I make a draft post accessible to everyone?

I have several unpublished posts in my Wordpress website and I am trying to make it accessible for normal users (who are not logged in) using the normal post slugs (site.com/post-here). I understand ...
Amal Murali's user avatar
13 votes
4 answers
23k views

How do I remove dashboard access from specific user roles?

I'd like to prevent certain user roles from accessing the dashboard http://www.openeye.net/wp-admin/ at all. I've moved and restyled user profiles to a new page that's viewable on the site. How would ...
Zach Shallbetter's user avatar
13 votes
3 answers
24k views

Find out if logged in user is not subscriber

Is there a conditional tag that will allow me to display certain content only if the user is NOT a subscriber?
Nasir Zia's user avatar
  • 293
12 votes
7 answers
23k views

Disallow user from editing their own profile information

I'm currently developing an intranet and I am using Justin Tadlock's Members plugin to control roles and capabilities. I have created a HR role to allow Human Resources staff to create and edit user ...
Scott's user avatar
  • 12.2k
12 votes
2 answers
12k views

What action should I hook into when adding roles and capabilities?

I'm going to be using add_role() and $role->add_cap() to set up a new custom role and attach a new capability to existing roles. I'm wondering where the best place to do this is? Obviously I can do ...
Tom Auger's user avatar
  • 7,046
12 votes
2 answers
6k views

add_role() run only once?

I was surprised to discover that add_role() modifies the database and fails if the role already exists. There are two implications here, one first more serious than the other: 1) if you're in ...
Tom Auger's user avatar
  • 7,046
11 votes
1 answer
9k views

Change author base slug for different roles

Is it possible to change the author base slug according to his role? For example, authors get example.com/ninja/%username% and subscribers get example.com/trainee/%username%? I am thinking of ...
Maxim Zubarev's user avatar
11 votes
2 answers
45k views

What the user_status column?

I was look in the wp_users table a " user_status " column...( all contain zero ) What works is this data?
l6ls's user avatar
  • 331
11 votes
4 answers
2k views

Custom post type role permissions won't let me read

I cannot get it so that my user role for a supplier can read the shipments post type. It shows up in their menu but when you click on it you get you are not allowed to view this page error message. ...
Nicholas Koskowski's user avatar
10 votes
6 answers
41k views

How to prevent access to wp-admin for certain user roles?

I did try using the plugin Front End Users but this clashes with something as it prevents access to some front end pages. So I need to manually just set it so that anyone who isn't one of two ...
Claire's user avatar
  • 342
10 votes
3 answers
19k views

Check if user is admin by user ID

Any ideas how to check if user (by user ID) is administrator? I don't mean currently logged in user.
jmeinlschmidt's user avatar
10 votes
5 answers
14k views

WordPress SEO by Yoast: Hide Meta Boxes in Posts for Non-admins

I have multi-author website and I am not very comfortable for allowing all members to enter SEO details in the posts they are publishing. I would like this would be visible only to Administrator of ...
Audrius's user avatar
  • 111
10 votes
5 answers
35k views

what's the meaning of the field wp_capabilities in table wp_usermeta

I am new to wordpress, in table wp_usermeta I notice that we have a row meta_key meta_value wp_capabilities a:1:{s:13:"administrator";b:1;} First, what's the meaning of ...
diligent's user avatar
  • 279
10 votes
1 answer
107k views

Check IF is a "single product page" and Check the "role" for a Redirect

After much research on the net, I have not found a solution that works. Do you know how can I do that on woocommerce : I try that for the moment : function cm_redirect_users_by_role() { $...
moikben's user avatar
  • 101
10 votes
3 answers
30k views

Send user activation email when programmatically creating user

I wondered if someone here might be able to help. Basically, I've created a custom registration form that when validated, inserts a user to the user table. function _new_user($data) { // ...
Joe Buckle's user avatar
10 votes
2 answers
18k views

Allowing custom role access to custom post type in back end

So I'm having some issues with this and I can't see why. I just need a custom role that can access the blog in the back end. I've added a new post type with a Capability type of blog and a new user ...
Chris Morris's user avatar
10 votes
1 answer
2k views

What's the difference between Role and Meta capabilities; When to use map_meta_cap() filter

I'm getting very confused about the following things: difference between Role and Meta capabilities, difference between Meta and Primitive capabilities, when to use map_meta_cap() filter. There were ...
dashaluna's user avatar
  • 2,082
9 votes
3 answers
6k views

How to prevent a post from being deleted?

For auditing issue, I only want a post can be trashed, but not deleted - for all users. So I have a plugin like add_action('before_delete_post', function($id) { wp_die(0); }); But seems ...
Yoga's user avatar
  • 909
9 votes
1 answer
8k views

Execute a function when admin changes the user role

How can I execute a function, when admin changes the user role of a user? I have two user roles: one is agent and the other one is client . My need is that when admin changes the user role of ...
ron r's user avatar
  • 333
9 votes
3 answers
9k views

Groups of capabilities: users with multiple roles?

I'm pretty sure I understand the roles and capabilities setup in WordPress: granular capabilities, grouped together in roles that can be assigned to users. Code should check the granular capabilities, ...
lpryor's user avatar
  • 268
9 votes
0 answers
833 views

User-edit role setting distinct from wp_capabilities? [closed]

I need find out how $profileuser->roles is set. wp_capabilities can hold multiple roles, whereas user-edit role caters only for a single role. Under certain circumstances it is possible for there ...
Richard Padwick's user avatar
8 votes
3 answers
8k views

What do unfiltered_html and unfiltered_upload actually filter?

Among WordPress' capabilities are unfiltered_html and unfiltered_upload, however I have yet to find any documentation about what specifically they allow or prevent in their filtering. The only ...
j08691's user avatar
  • 765
8 votes
1 answer
7k views

Restrict Contributors to view only their own custom post types?

For our 'Posts' type, our Contributors can see only their own posts, which is what we want. But for our custom post types, Contributors can see every post, including drafts. Is there a way to limit ...
bocoroth's user avatar
8 votes
2 answers
2k views

alphabetically order role drop-down selection in dashboard

The site I'm working on will have a very large number of unique user roles via a members plugin. Because of that, I'd like to have the Role drop-down selection on the Add New User page to display ...
Chirico's user avatar
  • 83

1
2 3 4 5
28