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
37 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
0 votes
0 answers
40 views

Understanding capabilities parameter in register_post_type()

So far what I've understood: Capabilities parameter allows the plugin to set edit, read and delete capabilities for a certain post_type applicable to the all user roles. The primitive capabilities are ...
brittle_spirit's user avatar
0 votes
0 answers
17 views

edit slider plugin capability for custom_role

I have create a new user role and I have given the following permission. add_role( 'custom_role', __( 'Custom Role' ), array( 'read' => true, 'edit_pages' => ...
ruzanna's user avatar
-1 votes
1 answer
27 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
18 views

How might I enable a user to view Draft pages from a different Author, without the ability to edit?

Is there a feasible way to allow a user to view Draft pages made by other authors, without granting them the ability to edit these pages? As a test, I gave a Subscriber the "edit_pages" ...
joe's user avatar
  • 46
0 votes
0 answers
110 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
24 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
18 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
395 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
  • 435
0 votes
1 answer
40 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
24 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
  • 27
0 votes
0 answers
21 views

How to fix the Post Preview Button (CPT & map_meta_cap)

I'm trying to create a custom post type that can be edited by users with a custom role (as well as administrators, editors and authors). Althought the idea for the users with this custom role is for ...
Alceo Mazzaccherini's user avatar
3 votes
0 answers
33 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
40 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,275
0 votes
1 answer
114 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
137 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
  • 482
1 vote
1 answer
56 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
299 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
22 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
  • 337
1 vote
0 answers
191 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
47 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
29 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
630 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
0 votes
1 answer
78 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,420
1 vote
1 answer
156 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
835 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
616 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
24 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
213 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
  • 27
0 votes
1 answer
604 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
725 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
60 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
59 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
25 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
213 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
  • 152
1 vote
1 answer
115 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
922 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
93 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
24 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
58 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
0 votes
0 answers
42 views

How can restrict certain users from delete a category but can view only in wordpress?

I would like to remove the capability of 'delete_term' for certain users. If can find the code which shows the 'delete' from 'wp-admin/includes/class-wp-terms-list-table.php' line number so where ...
vowal's user avatar
  • 1
0 votes
1 answer
359 views

current_user_can() causing critical error

I am writing a function to add a link to the Media Library in the admin menu on front end: function add_media_link_to_admin_menu( $wp_admin_bar ) { // add Media Library to admin menu $...
c_estep_tcbguy's user avatar
0 votes
0 answers
73 views

How to give plugin access to specific role(s)

How do I restrict plugin access to a specific user role? I wrote/installed a simple plugin that's listed in the left navbar in wp-admin. However, I'd like to only have it show for specific roles. I ...
Joshua JJ S's user avatar
3 votes
0 answers
179 views

Custom post type capabilities require "create_posts" to access the edit posts list page

I have a custom post type and a custom user role that I want to be able to do everything but delete and create this post type. However, this user role can't view the dashboard's list of posts for ...
Zach Wat's user avatar
0 votes
0 answers
23 views

Allow contributor user role to perform copy operation PHP

I have posted the issue on Stack Overflow but didn't get any solution. So now I am posting here. I want to allow contributor user role can copy file from one location to another location. I am using ...
DevD's user avatar
  • 31
0 votes
2 answers
369 views

Allow comments only for custom post type

I want to allow comments only for custom post types but not for normal posts or pages. What would be the best way to do that? I can think of one way that is a bit ugly. One would be to remove the ...
TheKidsWantDjent's user avatar
0 votes
1 answer
188 views

How to make WordPress 'editor' role to list/view/add/edit users only with the role 'author'?

I have added some extra capabilities to the existing 'editor' role in wordpress with: function add_uedit_caps() { $role = get_role('editor'); $role->add_cap('create_users'); $role->...
sariDon's user avatar
  • 255
0 votes
0 answers
139 views

current_user_can( 'edit_user' ) does not work

I don´t clearly understand why this code does not work : //Front-end profile page global $current_user; if ( current_user_can( 'edit_user') ) { ... } $current_user output : ["allcaps"]=> ...
J.BizMai's user avatar
  • 810
0 votes
1 answer
28 views

Restricting shortcode for users

anyway to block any user /role(except the admin) to use shortcode? i want to keep some specific shortcode secret. if somehow users come to know, they cant use it. if only admin writes the shortcode it ...
Abdullah Al Muaz's user avatar
1 vote
0 answers
52 views

Adding user capabilities for a custom taxonomy of a custom post type for a custom user

I have a custom user role I've set up that has access only to 1 specific custom post type and nothing else ( no access to post, pages etc. ). I've got it working however I can't seem to figure out how ...
R. Brenchley's user avatar

1
2 3 4 5
11