Remove Custom Capability
I have created a custom post type 'book'. All book post-type are public, so I want to remove some capabilities such as 'delete_private_books', 'read_private_books' etc. How can I achieve this since when I activate member plugin it show all default capabilities including the above mentioned which has nothing to do with my custom post type.
I have registered my post type book and added capabilities to it.
$labels = array(
'name' = _x( 'Books', 'post type general name' ),
'singular_name' = _x( 'Book', 'post type singular name' ),
'menu_name' = _x( 'Book', 'admin menu' ),
'name_admin_bar' = _x( 'Book', 'add new on admin bar' ),
'add_new' = _x( 'Add New', 'Book' ),
'add_new_item' = __( 'Add New Book' ),
'new_item' = __( 'New Books' ),
'edit_item' = __( 'Edit Books' ),
'view_item' = __( 'View Books' ),
'all_items' = __( 'Books' ),
'search_items' = __( 'Search Books' ),
'parent_item_colon' = __( 'Parent text:' ),
'not_found' = __( 'No Books found.' ),
'not_found_in_trash' = __( 'No Books found in Trash.' )
);
$capabilities = array(
'edit_post' = 'edit_books',
'read_post' = 'read_books',
'delete_post' = 'delete_books',
'edit_posts' = 'edit_books',
'edit_others_posts' = 'edit_others_books',
'publish_posts' = 'publish_books',
'read_private_posts' = 'read_private_books',
'create_posts' = 'edit_books',
'delete_posts' = 'delete_books',
'delete_private_posts' = 'delete_private_books',
'delete_published_posts' = 'delete_published_books',
'delete_others_posts' = 'delete_others_books',
'edit_private_posts' = 'edit_private_books',
'edit_published_posts' = 'edit_published_books',
);
$args = array(
'labels' = $labels,
'public' = true,
'publicly_queryable' = true,
'show_ui' = true,
'show_in_menu' = false,
'query_var' = true,
'rewrite' = array('slug' = 'books'),
'capability_type' = 'books',
'has_archive' = true,
'hierarchical' = false,
'menu_position' = '',
'supports' = false,
'map_meta_cap' = null,
'capabilities' = $capabilities,
);
register_post_type( 'wp-type-books', $args );
Topic capabilities plugin-development permissions custom-post-types Wordpress
Category Web