WordPress custom post type – Invalid post type?

Why do I get Invalid post type for:

function keyword_pages_init() {
    $args = array(
      'label' => 'Keywords',
        'public' => true,
        'show_ui' => true,
        'capability_type' => 'page',
        'hierarchical' => false,
        'rewrite' => array('slug' => 'keyword'),
        'query_var' => true,
        'menu_icon' => 'dashicons-admin-page',
        'supports' => array(
            'title',
            'editor',
            'excerpt',
            // 'trackbacks',
            //'custom-fields',
            //'comments',
            'revisions',
            'thumbnail',
            'author',
            'page-attributes',
            )
        );
    register_post_type( 'keyword', $args );
}
add_action( 'init', 'keyword_pages_init' );

What is gone wrong?

But it is fine with the keyword with a s:

function keyword_pages_init() {
    $args = array(
      'label' => 'Keywords',
        'public' => true,
        'show_ui' => true,
        'capability_type' => 'page',
        'hierarchical' => false,
        'rewrite' => array('slug' => 'keywords'),
        'query_var' => true,
        'menu_icon' => 'dashicons-admin-page',
        'supports' => array(
            'title',
            'editor',
            'excerpt',
            // 'trackbacks',
            //'custom-fields',
            //'comments',
            'revisions',
            'thumbnail',
            'author',
            'page-attributes',
            )
        );
    register_post_type( 'keywords', $args );
}
add_action( 'init', 'keyword_pages_init' );

Why!??

Read more here: WordPress custom post type – Invalid post type?

Leave a Reply

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