Categories
CMS Mastering Development Wordpress

Invalid Menu Items โ€“ The most interesting question

The question needs it so I captured the error.It is necessary so
please watch it.

https://youtu.be/lME3lY-kNbA if it doesnt open, please try this:

https://www.youtube.com/watch?v=lME3lY-kNbA&feature=youtu.be

I told the question on youtube video so I share only the code like what I said on video.

I hear that video,video,video are you youtuber? ๐Ÿ˜€ no, it needed

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:

nowadays, I select prayer for functions names ๐Ÿ˜€ such as masallah ( I hope the god protect ) or insallah ( I hope God will help to become real ) but yes I am here to ask ๐Ÿ˜€

// 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 );

Leave a Reply

Your email address will not be published. Required fields are marked *