Adds a capability to a role or specific user.

learn more… | top users | synonyms

0
votes
1answer
28 views

Admin: Get all user for Custom Role

I made a custom post type evenement with these capabilities. Here, I just put the capabilities parameters. 'capability_type' => 'evenement', 'map_meta_cap' => true, 'capabilities' => array( ...
0
votes
0answers
36 views

Custom Capability - show plugin menu to these users and admins only

I have created a plugin which has custom menu pages. The plugin creates two roles upon activation (let's say role 1 and role 2). role 1 is used for some coding and works fine, WordPress users are ...
1
vote
1answer
297 views

add_cap only adding the first two in array

After numerous days of trying to track down a problem in code, it turns out that the add_cap is only taking the first two in an array. The first one (editor) will only add delete_others_pages and ...
1
vote
0answers
60 views

Purpose of Adding Capability to Role But Not Grant?

I am attempting to create a custom role upon activation of my plugin. Along with that role, I wanted to add new capability to that role to access later. Now, after reading the Codex, I am totally ...
0
votes
1answer
1k views

remove other tabs in new wordpress media gallery

I recently updated my WordPress site into the latest WordPress version, and i added a code to my functions.php that would add a capability to subscriber to upload using WordPress media upload. I ...
1
vote
3answers
423 views

How to assign capabilities to user NOT to User Role

Is there any way to assign custom capabilities to user, I'm NOT talking about User Role. I'm running a multi author blog where I assigned user role of "Author" to all of my authors. But I need a ...
4
votes
2answers
806 views

Allow roles below admin to add subscribers only

I want to give a group of user types (Editor + a custom role) the add_users /create_users capability. The only catch is that I wanted to limit that capability to adding 'subscriber' type users only, ...
3
votes
1answer
361 views

The 'user_has_cap' hook seems to take two page loads to trigger

This question relates to another question I asked recently (http://wordpress.stackexchange.com/questions/29009/how-to-assign-specific-users-the-capability-to-edit-specific-pages-posts-cus/), the ...
5
votes
1answer
833 views

Confusion with adding meta capabilities to a role after registering a Custom Post Type with corresponding 'capability_type' parameter

I got quite confused with Custom Post Type (CPT) 'capability_type' parameter and adding generated capabilities to a role. So I've got a CPT called 'external_role' registered as following: ...
6
votes
1answer
2k 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 ...
0
votes
3answers
2k views

How can I grant capabilities directly to users (not roles) in wp-admin?

I want to create dynamic capabilities using WP_Role::add_cap(), something like $author_role = get_role('author'); foreach ($sections as $section) { $author_role->add_cap( ...
2
votes
3answers
2k views

How to 301 private posts rather than 404?

How do I 301 redirect private pages, rather than 404 them? If a post is private, WordPress filters it out in the SQL query, so there are no $post variables to work with. I'd like for this code to ...