Created
April 30, 2018 21:52
-
-
Save dnavarrojr/245e0c032e0a10dd619c3c29ac294f9e to your computer and use it in GitHub Desktop.
WordPress Registered Post Type Capabilities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: TSCPL CPT Test | |
*/ | |
function tscpl_register_teamrooms_cpt() { | |
/** | |
* Post Type: Team Rooms. | |
*/ | |
$labels = array( | |
"name" => __( "Team Rooms", "" ), | |
"singular_name" => __( "Team Room", "" ), | |
"menu_name" => __( "Team Rooms", "" ), | |
"all_items" => __( "All Reservations", "" ), | |
"add_new" => __( "Add New", "" ), | |
"add_new_item" => __( "Add New Reservation", "" ), | |
"edit_item" => __( "Edit Reservation", "" ), | |
); | |
$args = array( | |
"label" => __( "Team Rooms", "" ), | |
"labels" => $labels, | |
"description" => "", | |
"public" => false, | |
"publicly_queryable" => true, | |
"show_ui" => true, | |
"show_in_rest" => true, | |
"rest_base" => "", | |
"has_archive" => false, | |
"show_in_menu" => true, | |
"exclude_from_search" => true, | |
"capability_type" => "teamrooms", | |
"capabilities" => array( | |
"create_posts" => "edit_posts", | |
"delete_others_posts" => "edit_posts", | |
"delete_post" => "edit_posts", | |
"delete_posts" => "edit_posts", | |
"delete_private_posts" => "edit_posts", | |
"delete_published_posts" => "edit_posts", | |
"edit_others_posts" => "edit_posts", | |
"edit_post" => "edit_posts", | |
"edit_posts" => "edit_posts", | |
"edit_published_posts" => "edit_posts", | |
"publish_posts" => "edit_posts", | |
"read" => "read", | |
"read_post" => "read", | |
"read_posts" => "read", | |
"read_private_posts" => "edit_posts", | |
), | |
//"map_meta_cap" => true, | |
"hierarchical" => false, | |
"rewrite" => false, | |
"query_var" => true, | |
"menu_position" => 6, | |
"menu_icon" => "dashicons-groups", | |
"supports" => array( "title", "author" ), | |
); | |
register_post_type( "teamrooms", $args ); | |
} | |
add_action( 'init', 'tscpl_register_teamrooms_cpt' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment