Invalid Menu Items [closed]

Question

I registered a taxonomy named districts, but when I add districts to nav menus, the nav menu items are invalid! Here is the code that registers the taxonomy:

this one works:

function deneme() {

    // Add new taxonomy, make it hierarchical like categories
    //first do the translations part for GUI

        $labels = array(
            'name' => _x( '000', 'taxonomy general name' ),
            'singular_name' => _x( '000', 'taxonomy singular name' ),
            'search_items' =>  __( '000' ),
            'all_items' => __( 'All Locations' ),
            'parent_item' => __( 'Parent Locations' ),
            'parent_item_colon' => __( 'Parent Location:' ),
            'edit_item' => __( 'Edit Location' ),
            'update_item' => __( 'Update Location' ),
            'add_new_item' => __( 'Add New Location' ),
            'new_item_name' => __( 'New Topic Location' ),
            'menu_name' => __( '000' ),
        );

    // Now register the taxonomy

        register_taxonomy('000',array('post'), array(
            'hierarchical' => true,
            'labels' => $labels,
            'show_ui' => true,
            'show_admin_column' => true,
            'query_var' => true,
            'show_in_rest' => true,
            'rewrite' => true,
            'rewrite' => array( 'slug' => '000' ),
            'has_archive' => true,
        ));

    }

    add_action( 'init', 'deneme', 0 );

and this is the problem source:

// 2. ekleme

function masallah() {

// Add new taxonomy, make it hierarchical like categories
//first do the translations part for GUI

    $labels = array(
        'name' => _x( 'Districts', 'taxonomy general name' ),
        'singular_name' => _x( 'District', 'taxonomy singular name' ),
        'search_items' =>  __( 'Search Districts' ),
        'all_items' => __( 'All Districts' ),
        'parent_item' => __( 'Parent Districts' ),
        'parent_item_colon' => __( 'Parent District:' ),
        'edit_item' => __( 'Edit District' ),
        'update_item' => __( 'Update District' ),
        'add_new_item' => __( 'Add New District' ),
        'new_item_name' => __( 'New Topic District' ),
        'menu_name' => __( 'Districts' ),
    );

// Now register the taxonomy

    register_taxonomy('Districts',array('post'), array(
        'hierarchical' => true,
        'labels' => $labels,
        'show_ui' => true,
        'show_admin_column' => true,
        'query_var' => true,
        'show_in_rest' => true,
        'rewrite' => true,
        'rewrite' => array( 'slug' => 'districts' ),
        'has_archive' => true,
    ));

}

add_action( 'init', 'masallah', 0 );
0
, , knockknock 4 years 2020-03-26T08:50:58-05:00 0 Answers 119 views 0

Leave an answer

Browse
Browse