fazarcon

Add role capability

Jun 9th, 2022
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. add_filter( 'register_post_type_args', function( $args, $post_type ) {
  2. if ( 'gblocks_templates' === $post_type ) {
  3. $args['capability_type'] = 'post';
  4. $args['show_in_menu'] = true;
  5. $args['capabilities'] = array(
  6. 'publish_posts' => 'edit_posts',
  7. 'edit_posts' => 'edit_posts',
  8. 'edit_others_posts' => 'edit_posts',
  9. 'delete_posts' => 'edit_posts',
  10. 'delete_others_posts' => 'edit_posts',
  11. 'read_private_posts' => 'edit_posts',
  12. 'edit_post' => 'edit_posts',
  13. 'delete_post' => 'edit_posts',
  14. 'read_post' => 'edit_posts',
  15. );
  16. }
  17.  
  18. return $args;
  19. }, 10, 2 );
  20.  
Advertisement
Add Comment
Please, Sign In to add comment