Showing custom post type categories in the menu

Question

here is my custom post type and category:

//Register nav
register_nav_menus( array(
    'main_nav' => 'Main navigation'
) );

//Custom post types
add_action( 'init', 'create_post_type' );
function create_post_type() {
    register_post_type( 'assets',
        array(
            'labels' => array(
                'name' => __( 'Assets' ),
                'show_in_nav_menus' => true,
                'show_in_menu' => true,
                'singular_name' => __( 'Asset' )
            ),
        'public' => true,
        'has_archive' => true,
        )
    );
}

//Custom post type taxonomy/category
add_action( 'init', 'build_taxonomies', 0 );
function build_taxonomies() {
    register_taxonomy( 'categories', 'assets',
        array(
            'hierarchical' => true,
            'label' => 'Categories',
            'query_var' => true,
            'rewrite' => true
        )
    );
}

Even though I have ‘show_in_nav_menus’ turned on, it still won’t show. Is there something wrong with my code?

It seems to work fine otherwise. Thanks

0
, , , , Phill 3 years 2020-06-02T06:10:24-05:00 0 Answers 104 views 0

Leave an answer

Browse
Browse