Tagged: custom post types
01/12/2017 at 20:44 #4454AlistairSpectator
Is there a way to limit access to custom post types per role?
It seems to be all or nothing, just wondering if you can control the access per user role02/12/2017 at 01:09 #4455
If custom post types use the same capability type ‘post’, ‘Yes’, role may have access to all CPT with ‘edit_posts’ or to none of them.
But if every CPT uses own unique capability type then videos will be protected by ‘edit_videos’, ‘books’ – by ‘edit_books’, etc. You can grant access to the selected CPT at the role level in this case.
If you define CPT yourself via PHP or plugin, like “Custom Post Types User Interface” then use unique capability type for this purpose.
If CPT is defined by external source (theme or plugin) you can use “Force custom post types to use their own capabilities” option at “Settings->User Role Editor->Additional Modules” tab. Take into account that this option is applied to all existing custom post types, including WordPress built-in ‘attachments’. Correspondent roles modification would be required.26/01/2018 at 09:48 #4569scsedelParticipant
I have a similar issue and I think any post or custom post use the same capabilities.
Anyway, if I give custom post capabilities (create, edit, delete) to the new role, in my backend I can only see Post Menu on the left but not of any custom ones.
I created a user for you in my backend, I can give you access in private.
Thank you26/01/2018 at 10:16 #4570
You can send URL and admin credentials to support [at-sign] role-editor.com
To what custom post type do you wish to provide access and to what role?27/01/2018 at 02:35 #4571
Developer who added custom post types at your site registered theme with user capabilities default for the WordPress built-in posts, but protected admin menu items by ‘edit_pages’ capability.
I used “Admin menu access” add-on to get this information: https://www.role-editor.com/block-admin-menu-items
Then I added ‘edit_pages’ capability to the ‘Speaker’ role and blocked unneded menu items with the same “Admin menu” button.
Tests showed that while custom post types are defined with default ‘post’ capability type, they require really capabilities from the ‘pages’ group. So I added them to the ‘Speaker” role.15/01/2020 at 15:36 #6569thebigbanikParticipant
Hi Vladimir, I use the CPT UI plugin to create 3 custom post types BLOG, PROGRAMS and PERSONEL. In each custom post I have set accordingly “blog”, “programs” and “personel” as Capability type. Then in user role editor I have created capabilities for each type (create_blog, edit_blog, read_blog, delete_blog, publish_blog) and so on for programs and personel. If a user role has all this new types enabled he can see only the blog CPT in the admin menu. The other 2 capabilities seams to not work dispite that I have already enable them. BUT, if in the CPT UI “PROGRAMS”, I change the Capability type to “blog” then the user can see the PROGRAMS in the admin menu. I am not sure if there is something else that I have to set. (Of course “Force custom post types to use their own capabilities” is enabled from the beggining). Thank you for your time in advanced.15/01/2020 at 16:04 #6570
URE’s “Force custom post types to use their own capabilities’ works only for CPT, which has capability type ‘post’ – default for WordPress.
If you set other capability type for CPT you really should create capabilities list yourself, but look how WordPress does that for capability type ‘post’:
create_posts, edit_posts, delete_posts, publish_posts, edit_publish_posts, edit_others_posts.
So you have to add not edit_blog, but edit_blogs, etc. Add ‘s’ to the end, if did not insert special multiple form at the CPU UI plugin.08/02/2020 at 05:58 #6619whyknottParticipant
I have CPT UI installed and ACF plugin along with User Role Editor Pro. I created a new Custom Post Type called RENTALS and created a user role based on a duplicated role already created so I wouldn’t have to remember all the URE settings, except the new user role isn’t showing the featured image for the user. I’m an admin and I can visit RENTALS click on a listing and see the “Set Featured Image” tab in the document settings on the right column of the Gutenburg WP layout. Can you tell me what I need to do in order to get the Set Featured Image to work on a URE defined User?09/02/2020 at 03:46 #6620
Is ‘upload_files’ capability granted to a role?
- You must be logged in to reply to this topic.