Custom post type has no fields at all
-
I have written a function to register my custom post type, and I can see the menu item in the dashboard and can click add new. But when I do the editor page has no fields (because I have set the capability_type to post should I not be able to enter at least the post details? What about title, excerpt, thumbnail? None visible in the editor.
add_action( 'init', 'create_post_type', 0 );
function create_post_type() {
register_post_type( 'codingblog',
// CPT Options
array(
'labels' => array(
'name' => __( 'CodingBlogs' ),
'singular_name' => __( 'CodingBlog' ),
'menu_name' => __( 'My Coding Blog', 'blogus'),
'all_items' => __( 'All Coding Blogs', 'blogus'),
'view_item' => __( 'View Coding Blog', 'blogus'),
'add_new_item' => __( 'Add New Coding Blog', 'blogus'),
'add_new' => __( 'Add New', 'blogus'),
'edit_item' => __( 'Edit Coding Blog', 'blogus'),
'update_item' => __( 'Update Coding Blog', 'blogus'),
'search_items' => __( 'Search Coding Blog', 'blogus'),
'not_found' => __( 'Not Found', 'blogus'),
'not_found_in_trash' => __( 'Not found in Trash', 'blogus'),
),
'label' => __( 'codingblogs', 'blogus' ),
'description' => __( 'Coding Blog Posts', 'blogus'),
'supports' => __( 'title', 'editor', 'excerpt',
'author', 'thumbnail', 'comments',
'revisions', 'custom-fields', ),
'taxonomies' => array( 'post_tag', 'category' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'post',
'rewrite' => array('slug' => 'codingblogs'),
'show_in_rest' => true,
)
);
}
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.