Registering post type is not adding to admin menu

I started playing with an idea a few days ago that will be using custom post types. I’ve never used CPTs before and am running into issues with the basic registration process.

The following registration code is hooked into init and I have verified that it is running, however I am not seeing “Slides” appear in the admin menu.

Read More

*EDIT: WP_DEBUG is enabled and nothing is being produced.*

register_post_type(self::$post_type, array(
    'labels'               => array(
        'name'               => __('Slides', 'bonestheme'),
        'singular_name'      => __('Slide', 'bonestheme'),
        'add_new_item'       => __('Add New Slide', 'bonestheme'),
        'edit_item'          => __('Edit Slide', 'bonestheme'),
        'new_item'           => __('New Slide', 'bonestheme'),
        'view_item'          => __('View Slide', 'bonestheme'),
        'search_items'       => __('Search Slides', 'bonestheme'),
        'not_found'          => __('No Slide Found', 'bonestheme'),
        'not_found_in_trash' => __('No slides found in Trash', 'bonestheme')
    ),
    'capability_type'      => array('slide', 'slides'),
    'description'          => 'Represents a single slide in the header slideshow.',
    'hierarchical'         => false,
    'menu_position'        => 5,
    'public'               => false,
    'register_meta_box_cb' => array('SlideJS', 'createCPTMetaboxes'),
    'rewrite'              => false,
    'show_in_admin_bar'    => false,
    'show_in_nav_menus'    => true,
    'show_ui'              => true,
    'supports'             => array('title', 'thumbnail')
    )
);

remove_post_type_support( self::$post_type, 'editor' );

Related posts

1 comment

  1. Remove

    'capability_type'      => array('slide', 'slides'),
    

    This works

    add_action( 'init', 'slides_post_type' );
    function slides_post_type() {
    
    register_post_type( 'Slides',
        array(
    'labels' => array(
        'name'               => __('Slides', 'bonestheme'),
        'singular_name'      => __('Slide', 'bonestheme'),
        'add_new_item'       => __('Add New Slide', 'bonestheme'),
        'edit_item'          => __('Edit Slide', 'bonestheme'),
        'new_item'           => __('New Slide', 'bonestheme'),
        'view_item'          => __('View Slide', 'bonestheme'),
        'search_items'       => __('Search Slides', 'bonestheme'),
        'not_found'          => __('No Slide Found', 'bonestheme'),
        'not_found_in_trash' => __('No slides found in Trash', 'bonestheme')
    ),
    
    'description'          => 'Represents a single slide in the header slideshow.',
    'hierarchical'         => false,
    'menu_icon'            => 'dashicons-images-alt2',
    'menu_position'        => 5,
    'public'               => true,
    'register_meta_box_cb' => array('SlideJS', 'createCPTMetaboxes'),
    'rewrite'              => array( 'slug' => 'slides', 'with_front' => false ),
    'show_in_admin_bar'    => false,
    'show_in_nav_menus'    => true,
    'show_ui'              => true,
    'supports'             => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'revisions', 'page-attributes')
    ));
    }
    

    enter image description here

Comments are closed.