What capabilities does a WordPress User need to create and use patterns?

18 Views Asked by At

I have some custom post types and I've made some custom WordPress user roles and want them to be able to create and update WordPress block patterns.

What capabilities do I need to add to make creating patterns available to the user?

As an administrator the option is available, as a user with only permissions to the custom post type the option is hidden. I've googled for the answer with no result.

I'm looking for the specific capabilities to add to the role like

$role->add_cap( 'create_patterns' );
1

There are 1 best solutions below

0
Jay Dee On

Patterns are linked to the post capabilities.
Here is the code I found needed to use patterns:

//allow the creation of patterns
$role->add_cap( 'publish_posts' );

//edit synced posts and create un-synced posts
$role->add_cap( 'edit_published_posts' );

//list and use patterns
$role->add_cap( 'edit_posts' );