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
2answers
24 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 ...
0
votes
0answers
14 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 ...
0
votes
1answer
15 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 ...
0
votes
0answers
9 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 ...
0
votes
0answers
7 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 ...
0
votes
0answers
16 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'...
1
vote
1answer
59 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/...
1
vote
1answer
19 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 ...
0
votes
0answers
22 views

Manage roles and capabilities without loads of code

I want to manage user roles and permissions/capabilities. I've tried several plugins, but they save their settings to the database. Since we're running multiple environments with seperate databases, ...
0
votes
1answer
35 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 ...
0
votes
2answers
37 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('...
0
votes
1answer
24 views

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

How to write conditions on capabilities not on user role?
0
votes
0answers
27 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 ...
0
votes
0answers
21 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&...
1
vote
1answer
24 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 ...
0
votes
0answers
11 views

Custom Post Type Capabilities - delete_published not working

For some reason, the 'delete_plublished_articles' capability on my custom post type doesn't work. I'm removing this capability from the administrator role, but I'm yet able to delete published posts. ...
0
votes
0answers
15 views

Update a custom role with new capabilities

I have created a custom user role for a site where the role can do almost anything an administrator can do minus a few capabilities like: -Update, Delete, Upload plugins -Change, Delete, Upload Themes,...
0
votes
1answer
44 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.
0
votes
0answers
12 views

Capability for showing comments page in admin

I have created a new user role "advertiser" and added some capabilities. Advertiser has access to admin comments page /wp-admin/edit-comments.php and I need to know, which capability set to ...
0
votes
0answers
18 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 ...
0
votes
0answers
19 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 ...
1
vote
0answers
39 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 ...
0
votes
0answers
35 views

adding new role with custom capability

I am trying to add new role with custom capability here is what I have done so far : add_role('event_manager',__( 'Event Manager'),array( 'read' => true, 'create_posts' =>...
0
votes
0answers
20 views

unfiltered_html issue with custom guttenberg block on multisite network

i have a custom guttenberg block that creates a grid of icon buttons using the package react-fa-icon-picker, it works fine if the user is a super-admin, but for editors and admins it doesn't work ...
0
votes
0answers
11 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 ...
0
votes
1answer
28 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 $...
0
votes
0answers
52 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 ...
0
votes
0answers
13 views

How do I add a custom capability to a user role that would allow the user to add/remove specific users and not the entire list of users?

This may be slightly confusing but I will do my best to explain. I am trying to create a capability that would allow a user to add users to our site. They would be able to view and delete these users ...
1
vote
0answers
52 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 ...
0
votes
0answers
22 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 ...
0
votes
1answer
18 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 ...
0
votes
1answer
26 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->...
0
votes
0answers
34 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"]=> ...
0
votes
1answer
16 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 ...
1
vote
0answers
23 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 ...
0
votes
0answers
20 views

How to only display all posts to a custom User Role?

I have a custom user role and I want to display all custom website posts to them, without letting them edit/delete them. Right now the custom post doesn't show up in their dashboard. I know it will ...
1
vote
1answer
30 views

Why is my Custom Post Type not showing up after adding capabilities?

I'm trying to add a custom post types with capabilities, so a custom user role can do certain things with them. Eventually the custom role is a Client, and the post a Website, and I want clients to be ...
0
votes
0answers
29 views

option_page_capability_ add_filter is not working

I would like to give permission to editor to save the option field I have created (working fine with administrator). I read on several forums that the add_filter( 'option_page_capability_ is the ...
0
votes
0answers
14 views

Media not loading for some custom roles

I can't see my media library for my custom role "restricted user". The capabilities works well for the rest, but I can't see any image in my library (with this role only). The ajax loading ...
1
vote
2answers
129 views

Show metabox for a special role

I have special roles on my site. I use easy digital download. My user has access to the download page. I want the metabox not to see the number of sales. Can I hide this metabox for this role or user? ...
0
votes
0answers
34 views

How can Editor Role access and edit all Media

I am adding an Editor Role in WordPress which I want to have full access to the media files I being the administrator have uploaded. However, when I log in with the Editor's credentials (as an Editor),...
2
votes
1answer
1k views

Can't use /wp-json/wp/v2/plugins API endpoint even as administrator

Using Basic Authentication as an Administrator, I am getting an error code 401 Unauthorized : [rest_cannot_view_plugins] Sorry, you are not allowed to manage plugins for this site. error when I ...
0
votes
0answers
21 views

How to manage roles and capabilities [duplicate]

Roles and capabilities is easily the most confusing part of WordPress. Just when I think I have it sorted, I realise ...NO! I created a plugin and gave all the plugin admin pages in Dashboard: ...
3
votes
1answer
83 views

How to prevent users with “edit_others_posts” capability from editing admin posts

I have some posts that author is Administrator and some other posts that author is Editor After logging in as Editor, I can edit Administrator posts. I would like to prevent this. I find some ...
0
votes
1answer
28 views

How to restrict subscriber editing other posts but read specific posts in backend

I need to allow Subscribers to edit their posts (done) and read (see in backend) posts of specific author or with specific ID (to make copies of it). I found the code, but that's not enough: function ...
1
vote
1answer
20 views

What determines whether admin toolbar is shown to a logged-in user?

By default, Wordpress shows admin toolbar to Administrator, Editor, or Author but not to Subscriber or unauthenticated visitors. What determines whether admin toolbar is shown a logged-in user? I am ...
2
votes
1answer
26 views

Why do comment moderators need to have all create/edit/delete toboth posts and pages?

I struggled quitea bit to be able to set up my moderator account. Until I allowed all posts and pages capabilities and now the can finally moderate comments. I didn't deactivate one by one precisely ...
1
vote
0answers
11 views

How to set individual capability of post type in individual category

I need to add a new post type "Story". Each of my users I will give them an individual role to edit/view their own "Story"(One user one role). User Role only gives ability to limit capabilities based ...
2
votes
2answers
193 views

How to allow “Add New” capability of CPT when links to its UI are placed as a submenu?

(Edit: going for the "Student" badge, and wondering if anyone out there could up vote this question?) I answered a question about capabilities, but now I'm in need of help on the subject. And after ...
1
vote
1answer
73 views

How do you add customer capability after Woocommerce purchase?

Can I do something like this to add a capability after someone purchases a product in my child's function file? Please note, I'm using s2member and woocommerce, and I am a newbie. add_action( '...

1
2 3 4 5
10