WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I don't know how to figured out what's wrong with my code, Why Custom Post Types "Book" doesn't show on my dashboard, I logged as Admin and I use latest WordPress installed 3.4.1

Here with my code

function codex_custom_init() {

  $labels = array(
    'name' => _x('Books', 'post type general name'),
    'singular_name' => _x('Book', 'post type singular name'),
    'add_new' => _x('Add New', 'book'),
    'add_new_item' => __('Add New Book'),
    'edit_item' => __('Edit Book'),
    'new_item' => __('New Book'),
    'all_items' => __('All Books'),
    'view_item' => __('View Book'),
    'search_items' => __('Search Books'),
    'not_found' =>  __('No books found'),
    'not_found_in_trash' => __('No books found in Trash'), 
    'parent_item_colon' => '',
    'menu_name' => __('Books')


    $capabilities = array(
    'publish_posts' => 'publish_books',
    'edit_posts' => 'edit_books',
    'edit_others_posts' => 'edit_others_books',
    'delete_posts' => 'delete_books',
    'delete_others_posts' => 'delete_others_books',
    'read_private_posts' => 'read_private_books',
    'edit_post' => 'edit_book',
    'delete_post' => 'delete_book',
    'read_post' => 'read_book'

  $args = array(
    'labels' => $labels,
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true, 
    'show_in_menu' => true, 
    'query_var' => true,
    'rewrite' => true,
    'capability_type' => 'book',
    'capabilities' => $capabilities,
    'has_archive' => true, 
    'hierarchical' => false,
    'menu_position' => null,
    'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )



add_action( 'init', 'codex_custom_init' );

My code is to add new custom post with custom capabilities for usage of members plugin.

share|improve this question
Does your role have these capabilities? – toscho Jul 26 '12 at 12:10
you mean adding these role on Admin? – Gerald Jul 26 '12 at 12:41
Yes, exactly. If don’t have the capability to read or edit the post type you will not get the menu. – toscho Jul 26 '12 at 12:44
but My current user logged role is super admin :( so why this don't show up? – Gerald Jul 26 '12 at 12:49

Looks like a CPT with custom capability_type won't show up by default even as super admin. Even manually adding the permissions for the desired user role (licensing-admin in my case) didn't make it happen - I had to manually add the capabilities for the administrator as well, then everything fell into place.

Stuck this code in my plugin activation hook and good to go.

$roles = array( get_role('licensing-admin'), get_role('administrator') );

foreach($roles as $role) {
  if($role) {
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.