Registering custom post type menu editor problem

I’m trying to register custom post type this way:

add_action( 'init', 'vocabulary_register_post_type' );
function vocabulary_register_post_type() {
    $labels = array(
            'name'               => 'Słowniczek',
            'singular_name'      => 'Pojęcie',
            'menu_name'          => 'Pojęcia',
            'name_admin_bar'     => 'Pojęcie',
            'add_new'            => 'Dodaj nowe pojęcie',
            'add_new_item'       => 'Dodaj nowe pojęcie',
            'edit_item'          => 'Edytuj pojęcie',
            'new_item'           => 'Nowe pojęcie',
            'view_item'          => 'Wyswietl pojęcie',
            'all_items'          => 'Wszystkie pojęcia',
            'search_items'       => 'Wyszukaj pojęcia',
            'parent_item_colon'  => 'Nadrzędne książki',
            'not_found'          => 'Pojęć nie znaleziono',
            'not_found_in_trash' => 'Brak usuniętych pojęć'
    );
    $product_args = array(
        'public'             => true,
        'publicly_queryable' => true,
        'show_ui'            => true,
        'show_in_menu'       => true,
        'query_var'          => true,
        'rewrite'            => array( 'slug' => 'vocabulary' ),
        'capability_type'    => 'post',
        'has_archive'        => true,
        'hierarchical'       => false,
        'menu_position'      => null,
        'supports'           => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ),
        'labels'             => $labels
    );
    register_post_type( 'vocabulary', $product_args );
}

All works fine except I cant select any of those custom post types element to insert them into a menu (custom post type section doesn’t show in menu editor).
But… when I change last line

Read More
register_post_type( 'vocabularys', $product_args );

suddenly everything works as it should.
The problem is, that I have already few custom post type items, and don’t want to mess with database to change guids and post_type entires for them.

So the final question is – why first one doesn’t work, and the second one does?

After digging more – it seems it has something to do with the order when you add this code. Did clean wp318 installation and putted above code into default 2014 theme. After setting up the database and logging into backend there was no option in custom menu (after creating one).
Now did another install, this time didn’t change anything in the template, logged in, created menu. After that I have added code into functions.php – all did well, with exact same names.
So it looks like there is something blocked in database when custom post type is added in wrong time.

Related posts