Created
September 3, 2015 07:47
-
-
Save gaintsev/9f869d2123259cbe6ce2 to your computer and use it in GitHub Desktop.
Wordpress Custom Post Type Capabilities (admin only)
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 | |
function add_test_type() | |
{ | |
$labels = array( | |
'name' => _x('Тест', 'test'), | |
'singular_name' => _x('Тест', 'test'), | |
'menu_name' => _x('Тест', 'test'), | |
'name_admin_bar' => _x('Тест', 'test'), | |
'add_new' => _x('Добавить новый', 'test'), | |
'add_new_item' => _x('Добавить новый тест', 'test'), | |
'new_item' => _x('Новый тест', 'test'), | |
'edit_item' => _x('Редактировать тест', 'test'), | |
'view_item' => _x('Просмотр тест', 'test'), | |
'all_items' => _x('Все тест', 'test'), | |
'search_items' => _x('Поиск тест', 'test'), | |
'parent_item_colon' => _x('Родительское тест', 'test'), | |
'not_found' => _x('Не найдено', 'test'), | |
'not_found_in_trash' => _x('Не найдено', 'test'), | |
); | |
$supports = array( | |
'title', | |
'editor', | |
'thumbnail', | |
'excerpt', | |
); | |
$args = array( | |
'labels' => $labels, | |
'public' => true, | |
'publicly_queryable' => true, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'query_var' => true, | |
'rewrite' => array('slug' => 'test'), | |
'capability_type' => 'post', | |
'has_archive' => true, | |
'hierarchical' => false, | |
'menu_position' => null, | |
'supports' => $supports, | |
'menu_icon' => 'dashicons-megaphone', | |
//it happens here: | |
'capabilities' => array( | |
'edit_post' => 'update_core', | |
'read_post' => 'update_core', | |
'delete_post' => 'update_core', | |
'edit_posts' => 'update_core', | |
'edit_others_posts' => 'update_core', | |
'delete_posts' => 'update_core', | |
'publish_posts' => 'update_core', | |
'read_private_posts' => 'update_core' | |
), | |
); | |
register_post_type('test', $args); | |
} | |
add_action('init', 'add_test_type'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment