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
3 votes
0 answers
22 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 ...
user avatar
0 votes
0 answers
16 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 ...
user avatar
  • 1,267
0 votes
1 answer
13 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 ...
user avatar
0 votes
0 answers
7 views

Edit and delete permissions pages and posts

Does anybody know if it is possible to protects some pages and posts from editing / deleting unless if the role is admin? Not all posts and pages has to be protected against this! I can not read ...
user avatar
0 votes
0 answers
11 views

Disabled delete_others_posts if post is from admin

I need some help with capabilities. I created a new role for my theme with the capability "delete_others_posts". This role can delete posts from other users and also from admins. Is there a ...
user avatar
  • 17
0 votes
1 answer
13 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 ...
user avatar
  • 452
1 vote
1 answer
16 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(){...
user avatar
  • 13
1 vote
1 answer
40 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 ...
user avatar
0 votes
0 answers
14 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' ...
user avatar
  • 317
0 votes
0 answers
19 views

Restrict access only of custom post type with standard capabilities to edit_post

I'd like some of our registered users to add MEC calendar events. Our admins would then review and publish them. MEC does not use custom capabilities, but standard ones. I'm already using Restrict ...
user avatar
  • 121
0 votes
0 answers
63 views

user_has_cap filter allows "edit_others_posts" but not is not allowing updating/publishing

This filter is letting manager users edit specific posts created by other users: add_filter( 'user_has_cap', 'allow_manager', 10, 4 ); function allow_manager( $allcaps, $caps, $args, $user ) { // ...
user avatar
  • 101
1 vote
0 answers
50 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 ...
user avatar
  • 111
0 votes
0 answers
14 views

REST API - Allow /users endpoint depending on a custom capability

I am in a situation where I have to list users for a frontend app dropdown via REST API. By default, WP will not allow listing of users without list_users cap. My plugin has its own custom capability ...
user avatar
  • 7,585
0 votes
0 answers
22 views

remove "Edit" from select pages

I've had a good look around before asking this question so if it's already been cracked just point me in that direction! I've set up some custom core pages in order to work as "archive" ...
user avatar
0 votes
0 answers
27 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 ...
user avatar
  • 1
0 votes
0 answers
28 views

Set edit capability based on ACF relationship

I have a CPT for Businesses, which have a relationship to another CPT, region. Users can edit their own businesses, but I also have regional managers that I would like to give the ability to edit ...
user avatar
0 votes
1 answer
26 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?
user avatar
0 votes
0 answers
17 views

cannot get global $menu value in form request

I have register a route for edit_audience register_rest_route( 'ilms_plugin', 'edit_audience', [ 'methods' => 'POST', 'callback' => 'edit_audience', 'permission_callback' => '...
user avatar
0 votes
2 answers
146 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 ...
user avatar
  • 279
0 votes
1 answer
30 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->...
user avatar
  • 2,342
0 votes
1 answer
50 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/...
user avatar
0 votes
0 answers
387 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;...
user avatar
0 votes
2 answers
120 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 ...
user avatar
1 vote
0 answers
19 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 ...
user avatar
0 votes
1 answer
66 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 ...
user avatar
  • 17
0 votes
0 answers
65 views

How to allow Authors to access media library in Wordpress?

I have a multi-user Wordpress site and several users are assigned the Author role (I don't want those users to give the Editor roles for some obvious reasons). The Authors can upload pictures but they ...
user avatar
  • 103
0 votes
0 answers
11 views

How to allow comment authors to moderate their own comments on someone else's post?

In order for a user with an author role to edit their comment on someone else's post, they need to have 'edit_others_posts'. add_filter( 'map_meta_cap', 'comment_editing', 10, 4 ); function ...
user avatar
0 votes
0 answers
20 views

Customize or change error message from capability

I have a woocommerce set up that allows certain people to edit an order, unless the status of the order changes to make sure they don't revert status of an order that's in processing to something that'...
user avatar
  • 101
0 votes
1 answer
360 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/...
user avatar
  • 125
1 vote
1 answer
184 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 ...
user avatar
  • 21
0 votes
1 answer
54 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 ...
user avatar
  • 39
0 votes
2 answers
49 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('...
user avatar
  • 39
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?
user avatar
  • 39
0 votes
0 answers
58 views

Disable update for custom post type

I have a custom post type and all posts of this kind is created during a scheduled event which fetched all data from an external API. So far so good, the problem now is that I would like to prevent ...
user avatar
0 votes
0 answers
51 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&...
user avatar
  • 152
1 vote
1 answer
42 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 ...
user avatar
0 votes
1 answer
170 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.
user avatar
  • 17
0 votes
0 answers
26 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 ...
user avatar
0 votes
0 answers
23 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 ...
user avatar
1 vote
0 answers
52 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 ...
user avatar
0 votes
0 answers
18 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 ...
user avatar
  • 1
0 votes
1 answer
163 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 $...
user avatar
0 votes
0 answers
57 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 ...
user avatar
2 votes
0 answers
106 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 ...
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 ...
user avatar
  • 31
0 votes
1 answer
164 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 ...
user avatar
0 votes
1 answer
74 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->...
user avatar
  • 213
0 votes
0 answers
72 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"]=> ...
user avatar
  • 770
0 votes
1 answer
19 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 ...
user avatar
1 vote
0 answers
37 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 ...
user avatar

1
2 3 4 5
11