Advertisement
IlyaOlchikov

reg CPT with capabilities

Jun 7th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.44 KB | None | 0 0
  1. $labels = array('name' => 'FB accounts',
  2.    'singular_name' => 'FB account',
  3.    'menu_name' => 'FB accounts',
  4.    'parent_item_colon' => 'Родительский:',
  5.    'all_items' => 'Все FB accounts',
  6.    'view_item' => 'Просмотреть',
  7.    'add_new_item' => 'Добавить FB account',
  8.    'add_new' => 'Добавить FB account',
  9.    'edit_item' => 'Редактировать FB account',
  10.    'update_item' => 'Обновить FB account',
  11.    'search_items' => 'Найти FB account',
  12.    'not_found' => 'Не найдено',
  13.    'not_found_in_trash' => 'Не найдено в корзине' );
  14.   $args = array('labels' => $labels,
  15.    'supports' => array('title', 'author'),
  16.    'public' => true,
  17.    'menu_position' => 5,
  18.    'show_ui' => true,
  19.     'show_in_menu' => true,
  20.     'show_in_nav_menus' => true,
  21.     'publicly_queryable' => true,
  22.     'exclude_from_search' => false,
  23.     'has_archive' => true,
  24.     'query_var' => true,
  25.     'can_export' => true,
  26.     'rewrite' => true,
  27.     'capabilities' => array(
  28.       'edit_post' => 'edit_fb_account',
  29.       'edit_posts' => 'edit_fb_accounts',
  30.       'edit_others_posts' => 'edit_other_fb_accounts',
  31.       'publish_posts' => 'publish_fb_accounts',
  32.       'read_post' => 'read_fb_account',
  33.       'read_private_posts' => 'read_private_fb_accounts',
  34.       'delete_post' => 'delete_fb_account'
  35.     ),
  36.    'menu_icon' => 'dashicons-book');
  37.  
  38.   register_post_type('fb_account', $args);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement