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
0 votes
1 answer
14 views

How can I add the User Menu for Authors (role)?

I have authors on my site and I want them to be able to add/edit/remove users. I can see how I can add the relevant capabilities to the author role with get_role and add_cap. But, this does not ...
Justin Wylllie's user avatar
0 votes
1 answer
43 views

Force logout when role is changed

I'd like to forcefully log users out when their role is changed. For example, if a user is logged into the site and has an existing role of 'Editor' and I change the role to 'No role for this site', ...
Ryan's user avatar
  • 63
0 votes
0 answers
18 views

Allow users to manage some options without granting 'manage_options' capability

I don't want to grant the 'manage_options' capability to all of my users, but I want to give them the access to manage some. Is it possible to create something like 'my_custom_capability' to access ...
Movs's user avatar
  • 101
0 votes
0 answers
28 views

Restrict APP REST API for users with account and capabilities

I am building a Web Application, I use WordPress/Gutenberg for the front-end. It works well, but I want to add a way for the users who have a WordPress account to use my Application REST API, what ...
Robert's user avatar
  • 101
2 votes
4 answers
802 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
58 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
31 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
15 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
34 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
14 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
40 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
117 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
26 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
63 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
  • 878
0 votes
0 answers
22 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
282 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
103 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
80 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
43 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
269 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
28 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
38 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
97 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
62 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
270 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
389 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
539 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
448 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
75 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
35 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
218 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
319 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
3 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
37 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
313 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
768 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
79 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
81 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
2k 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
643 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
181 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

1
2 3 4 5
11