Skip to main content

Questions tagged [capabilities]

WordPress uses a concept of Roles, designed to give the site owner the ability to control what users can and cannot do within the site. Each role is allowed to perform a set of tasks called Capabilities.

Filter by
Sorted by
Tagged with
2 votes
2 answers
377 views

Remove or disable Appearance > Patterns

Not sure quite when, but a recent WordPress release has added a new WP Admin link under Appearance for Patterns: My themes don't use Gutenberg, and I've disabled it. But the Patterns screen is still ...
doofusb0y's user avatar
0 votes
2 answers
45 views

Hide comments from admin comments.php that user can't edit or manage

I am running into a problem in that I have users that can edit comments, but only those placed onto their own posts. Which is what I want. Unfortunately the edit-comments.php page shows all comments. ...
Klein's user avatar
  • 11
1 vote
0 answers
30 views

Only allow users (that are not admins) to edit a specific post

I am using a ACF field on the user profile.php to assign a post id to a user. The users need to be able to receive the capability to edit this post, but only this post. They should not be allowed to ...
Klein's user avatar
  • 11
3 votes
0 answers
13 views

Add/remove capability for blocks theme nav menu

I'm building a wp blocks theme for in-house websites with controlled branding. This theme will be rolled out to hundreds of websites. I want to create a second level administrator role and remove ...
Net Iconic's user avatar
0 votes
1 answer
29 views

Allowing a CPT post to be edited by a single user role

I am in the process of creating a form for a user to fill out to create a listing request which creates a CPT post and user record. In this process, I want to copy the subscriber role, rename it '...
php-b-grader's user avatar
1 vote
0 answers
13 views

Easiest way to create Reviewer Role: Can preview Drafts (and Private Pages) but not Edit them

This seems a bit of a hole in Wordpress Roles. I have a site with many cooks (Editors). I would like to give some of them read-only access to Draft and Private materials. This post goes a little way; ...
Chris Pink's user avatar
0 votes
2 answers
38 views

Non-super-admin users cannot access CPT even though I have explicitly added the capabilities to the user role

I've defined a CPT and any non-super admin user on any subsite cannot access it. I cannot figure out what is wrong with my code. CPT Definition: // Opportunities register_post_type( '...
grzybowski1911's user avatar
0 votes
0 answers
10 views

How to create a WP Capability that limits editing to posts in a certain category?

Is there a way to create a WP User Capability that only allows editing of posts in a certain category and no other posts? There are plugins that do this, but wondering how to do it in PHP code. It ...
Brian's user avatar
  • 1
1 vote
0 answers
96 views

How can I get all capabilities for a particular user?

I am trying to get an array of all caps for a given user. But the method get_role_caps() only returns the custom capabilities assigned to the user. The array does not contain the caps from the default ...
Elkrat's user avatar
  • 138
0 votes
0 answers
23 views

coauthors_plus_edit_authors to display metabox based on author caps

Need to display the coauthorplus metabox with author capabilities. On the documentation of the plugin they say its only with super admin and editor that the metabox is available. Any idea to add a ...
made leod's user avatar
0 votes
1 answer
40 views

Capability needed for user to have an author page?

Only those that are authors have an author page. But thing is my client wants to have users that have a page, but that do not have author capabilities (they can modify the info on it but not create ...
Fredy31's user avatar
  • 868
0 votes
0 answers
17 views

How to allow subscribers to create post of a new custom post type

I am working on a plugin which adds a new custom post type and I want all users to be able to create new posts of this type. Here is what I've got at the moment: $labels = array( 'name' ...
Petar Vasilev's user avatar
0 votes
1 answer
217 views

How can I display customizer's "Additional CSS" to administrators and editors (in multisite)?

In my multi-site WordPress, administrators and editors don't see the Additional CSS section in the customizer. I would like them to have access to that panel. Only super-admins can see the additional ...
JakeParis's user avatar
  • 663
0 votes
1 answer
92 views

Why is user_can_access_admin_page() an undefined function?

According to WordPress Developer Resources, the user_can_access_admin_page() function is still active and valid... https://developer.wordpress.org/reference/functions/user_can_access_admin_page/ ...
Lee's user avatar
  • 337
0 votes
1 answer
76 views

How to correctly override a filter?

function _bp_enforce_bp_moderate_cap_for_admins( $caps = array(), $cap = '', $user_id = 0, $args = array() ) { // Bail if not checking the 'bp_moderate' cap. if ( 'bp_moderate' !== $cap ) { ...
shenkwen's user avatar
  • 131
-1 votes
1 answer
36 views

Make plugin admin page visible to other roles

I have created a plugin that I want users with the role of 'Editor' to be able to see and use in their admin panel.Currently, only administrators can see and use this plugin. I believe it has ...
Pelle Nilsen's user avatar
0 votes
0 answers
258 views

current_user_can() returning true for capability when the user and role do not have the capability

I've been trying to remove the "Customize" from the admin bar by removing the capability from the 'tt_editor' role by adding this to the bottom of the init action function: $editor = ...
Jerome Beckett's user avatar
0 votes
1 answer
26 views

Can I remove WooCommerce specific product categories from shop managers?

Can I remove WooCommerce specific product categories from shop managers, so that they can publish products only in some specific categories. I tried this, but it's not working. $user = ...
Ricky's user avatar
  • 53
0 votes
0 answers
37 views

Adding plugin editing capability for Author

I am new to php environment. Any idea how we could enable plugin editing roles and capabilities for Author or another scenario could be adding as sub-admin with limited roles. Any help would be ...
B1ll1onBaba's user avatar
0 votes
1 answer
1k views

User Capabilities are not available in WP REST permission callback?

I want to only permit the execution of specific admin tasks for users who are currently logged in to the wp admin panel (via is_user_logged_in) and who have a specific capability (via ...
DevelJoe's user avatar
  • 497
0 votes
1 answer
75 views

Prevent all users from editing posts except admins using hooks

So I'm attempting to block out all post edits for all users except admins, so I have the following setup: add_filter('post_row_actions', [self::class, 'remove_edit_permissions'], 10, 2); public ...
theMap's user avatar
  • 25
0 votes
1 answer
26 views

Role capabilities issue

I need some help with capabilities for a CPT. I register a new CPT with a capability type 'agenda'. To do this I use the code below in the register array 'capability_type' => 'agenda', After ...
Jop's user avatar
  • 127
3 votes
0 answers
60 views

Locking Down Wordpress Application Password Permissions / Capabilities

I am working on a Wordpress installation where we recently decoupled the frontend into a NextJS application that is no longer hosted on the same domain as the admin. We are accessing data etc through ...
some weird rando's user avatar
0 votes
0 answers
55 views

Why can my subscribers create new posts for review?

My subscribers seem to have permission to create posts. After reading the documentation on capabilities, this shouldn't be the case. Subscribers should only be able to manage their own profile. I have ...
gillespieza's user avatar
  • 1,285
0 votes
1 answer
262 views

Restrict access to custom post type based on its taxonomy terms

I'm just beginning to understand the roles and capabilities in Wordpress and I'm not sure that I can do what I would like. I have a custom post type, "cats", that has specific taxonomies ...
Ellimac's user avatar
0 votes
1 answer
353 views

How can I check if a visitor can read a post?

I know how to check capabilities for logged in users, with $can_read = current_user_can('read',$post->ID); But the above code returnes false when the user is not logged. So how can I check if the ...
gordie's user avatar
  • 492
1 vote
1 answer
72 views

Add, edit specific CPT with custom role

Who can help me with roles and capabilities? I am stuck on this and I need some help. I want a role that only can add, remove edit etc. a specific CPT. What I have so far add_action('init', function(){...
Ben's user avatar
  • 13
1 vote
1 answer
522 views

Remove Capabilities from WP admin for specific user role

I am trying to remove some menu-links capabilities from the wp-admin for a user role called wsm. I have tried many ways and when i just add the code below it will remove those links from the menu for ...
Marc Tzjacker's user avatar
0 votes
0 answers
24 views

How to query users to count all with a custom capability and limit it to a set of roles?

On a site with 12 custom user roles I need to count users with the 'supervisor' custom capability but limited to four specific roles. The following code counts all users with the 'supervisor' ...
AJD's user avatar
  • 349
1 vote
0 answers
431 views

Custom post types as sub menu pages and role capabilities issue

I'm working on this: Create a menu entry in the admin panel name "Products" Have a dozen of custom post types, all as submenus items of my admin menu "Products" entry Allow a role ...
Bardyl's user avatar
  • 111
0 votes
0 answers
73 views

Why "Mine" is the default view when adding 'capability_type' in register_post_type

I'm tweaking default's wordpress permissions by adding my own via the capability_type and map_meta_cap in register_post_type(), but I noticed that as soon I add the capability_type argument, the ...
Zeldri's user avatar
  • 11
0 votes
1 answer
34 views

Which capabilities are available in Gravity Forms Salesforce plugin? [closed]

Which capabilities are there in Gravity Forms Salesforce plugin and what do they do?
Evert S.'s user avatar
0 votes
2 answers
1k views

Allow a user or role to view drafts and previews, but not other admin privileges?

How do I allow a specific user or a specific role to view drafts and previews, but not allow them to edit posts or have any other admin capabilities? I can add a custom capability to a role, but don't ...
Michael's user avatar
  • 281
1 vote
1 answer
206 views

Taxonomy terms can still be added when only assign_terms capability has been granted

I'm setting the capabilities for a taxonomy with the below: $assoc_tax->capabilities['manage_terms'] = "zzz"; $assoc_tax->capabilities['edit_terms'] = "zzz"; $assoc_tax->...
mozboz's user avatar
  • 2,578
1 vote
1 answer
312 views

Adding all custom capabilities to admin

When adding a custom post type using the "capability_type" argument, custom capabilities are automatically generated for the post type. https://developer.wordpress.org/reference/functions/...
user2806026's user avatar
0 votes
0 answers
1k views

Undefined array key 0 wp-includes/capabilities.php on line 76

as in the title. I tried to find solution, but people got quite another issue... Line 76: $post = get_post( $args[0] ); if ( ! $post ) { $caps[] = 'do_not_allow'; break;...
Kamil Pawłowski's user avatar
0 votes
2 answers
1k views

WordPress: Custom User Role cannot access Custom Post Type | "Sorry, you are not allowed to access this page"

The Objective: Create a custom post type and only give administrator and a custom role permission to view / control it. The Problem: For administrators, it works perfectly fine but for the custom role ...
Scott White's user avatar
1 vote
0 answers
36 views

Add menu items/actions for multisite users who are registered on the network but do not have a role or capability in any sites

We've built a custom application (Pressbooks) that sits on top of WordPress multisite and transforms the multisite into a CMS for book publishing. A frequent flow for super admins is to invite a new ...
Steel Wagstaff's user avatar
0 votes
1 answer
307 views

Give admin_menu permission to specific users

I created a admin menu for my Wordpress website. The capabillity / rules are set to manage_options. Now I want give permission to another user that is only an editor. Does anybody know how I can do ...
Jop's user avatar
  • 127
0 votes
1 answer
760 views

Select other roles as custom post authors

I created a custom post type ("Organization"), and I've also created a custom user role ("Representative"). Also, I've ensured that the Representative role has read/edit/create/...
wesf90's user avatar
  • 125
1 vote
1 answer
1k views

Add condition of user capability in WP_query

I am struggling a bit with my WP_query which includes a meta_query to limit posts based on ACF User field, but show all posts if user can 'edit_posts'. From my code below, the first two arrays work ...
Rein's user avatar
  • 21
0 votes
1 answer
77 views

How to keep the capability of users and disable Gutenberg editor in WordPress?

I disabled Gutenberg web builder/ editor using the following code: add_filter( 'use_block_editor_for_post', '__return_false' ); Somehow this impacted contributor's capability to submit post for ...
Ricky's user avatar
  • 53
0 votes
2 answers
80 views

How to add custom JavaScript in functions?

I want to write some JavaScript and want to assign that to a custom capability, I explored a lot but unfortunately none of them worked, any help will be appriciated. My codes are as below: add_action('...
Ricky's user avatar
  • 53
0 votes
1 answer
31 views

How to write conditions based on user capabilities not on user role?

How to write conditions on capabilities not on user role?
Ricky's user avatar
  • 53
0 votes
0 answers
573 views

See which user role / capability is needed to use a plugin

I have installed a plugin (https://de.wordpress.org/plugins/food-and-drink-menu/) for which I want to assign permissions to a normal "editor" user. I found the plugin "User Role Editor&...
tim's user avatar
  • 164
1 vote
1 answer
177 views

Logout users upon login, based on caps/role?

To reduce spam registrations, users are assigned the pending role until they're vetted (at which point they're assigned the subscriber role). The pending role has no capabilities. When pending users ...
arielsfr's user avatar
2 votes
2 answers
2k views

How to get all capabilities

how to get all capabilities regardless of user roles? so far I am only seeing tutorial of how to get capabilities per user. I want to list all available capabilities in one page.
murni's user avatar
  • 37
0 votes
1 answer
179 views

CPT requires manage_options and edit_posts for some reason

I made a CPT called sponsor. I set map_meta_cap to true and capability_type to sponsor. I created a custom role that has edit_sponsors, as well as all the other stems (delete, publish, etc., each with ...
Luke Sawczak's user avatar
0 votes
0 answers
26 views

User role and capablities only for 1 plugin

What if i want a user called Marketing only to see the Slimstat plugin? The rest of the admin menu should be invisible for him. (for a external marketing agency that should see our stats but only our ...
MarcoDocker's user avatar
1 vote
0 answers
70 views

My subscriber has the "edit comment" capability but can't edit comment

When i use the wp_get_current_user function to display all informations about my user (subscriber), it shows that i can edit comment : I tried to display an edit comment button next to each comment ...
PrescilliaDSD's user avatar

1
2 3 4 5
11