Cannot create CPT with Custom Capabilities if Block Editor is used
-
Hello, First just to say, this plugin is ingenious. Works wonders for me.
I have this strange issue on a website where I need to allow access granularly per user, or user role to to specific CPT’s.
This is an example of custom caps for a “project” cpt.'capability_type' => 'page',
'show_in_rest' => true,
'rest_base' => $interes,
'rewrite' => $rewrite,
'capabilities' => array(
'publish_posts' => 'publish_apuri_interes',
'edit_posts' => 'edit_apuri_interes',
'edit_others_posts' => 'edit_others_apuri_interes',
'delete_posts' => 'delete_apuri_interes',
'delete_others_posts' => 'delete_others_apuri_interes',
'read_private_posts' => 'read_private_apuri_interes',
'edit_post' => 'edit_apuri_interes',
'delete_post' => 'delete_apuri_interes',
'read_post' => 'read_apuri_interes',
'publish_pages' => 'publish_apuri_interes_new'
),
I can edit existing, delete etc. But I CANNOT create NEW ‘project’ posts.
Now if I change ‘show_in_rest’ to false, i.e. dissable the gutenberg editor, I can create new ‘project’ posts. Also, If I comment out the capabilities array in post registration args it also works no problem, but with caps and gutenberg I get the blank page. I sitll see the add new button, but if I click it I get a completely blank edit page. Nothing is rendered, and console gives me 301 forbidden.
the error says:GET https://domain.com/wp-json/wp/v2/projekt/23127?context=edit&_locale=user 403 (Forbidden)
What am I missing, is there a specific cap I need to add to allow gutenberg to work here?
Thanks
- The topic ‘Cannot create CPT with Custom Capabilities if Block Editor is used’ is closed to new replies.