Categories to CPT not showing
-
Hi there,
I’ve added CPT ‘blog’ by creating a plugin with the code below. This works. Now I want to add categories, but I can’t seem to make it work. The categories don’t show up in the post editor. I’ve read here and there about show_in_rest and tried to add it, but no succes. Can someone tell me what to do differently? This is the code now:
function custom_post_type() { $labels = array( 'name' => _x( 'Blog', 'Blogpost General Name', 'text_domain' ), 'singular_name' => _x( 'Blog', 'Blogpost Singular Name', 'text_domain' ), 'menu_name' => __( 'Blog post', 'text_domain' ), 'parent_item_colon' => __( 'Parent Item:', 'text_domain' ), 'all_items' => __( 'Alle posts', 'text_domain' ), 'view_item' => __( 'View Item', 'text_domain' ), 'add_new_item' => __( 'Add New Item', 'text_domain' ), 'add_new' => __( 'Nieuwe post', 'text_domain' ), 'edit_item' => __( 'Edit Item', 'text_domain' ), 'update_item' => __( 'Update Item', 'text_domain' ), 'search_items' => __( 'Search Item', 'text_domain' ), 'not_found' => __( 'Not found', 'text_domain' ), 'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ), ); $args = array( 'label' => __( 'blog', 'text_domain' ), 'description' => __( 'Post Type voor blogs', 'text_domain' ), 'labels' => $labels, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'comments', 'custom-fields', ), 'taxonomies' => array( 'gastblog', 'informatief', 'reisverhalen' ), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'menu_position' => 5, 'menu_icon' => '', 'can_export' => true, 'has_archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'capability_type' => 'page', ); register_post_type( 'blog', $args ); } // Hook into the 'init' action add_action( 'init', 'custom_post_type', 0 );
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Categories to CPT not showing’ is closed to new replies.