So I'm trying to create a custom post type for my theme. I've written the function to register the post type and I can add a post from the admin panel, but when I try to view the new post's permalink, I get a 404 not found page.

Here's my post type function:

add_action( 'init', 'create_press_coverage' );

function create_press_coverage() {
    register_post_type( 'press_coverage',
            'labels' => array(
                'name' => 'Press Coverages',
                'singular_name' => 'Press Coverage',
                'add_new' => 'Add New',
                'add_new_item' => 'Add New Press Coverage',
                'edit' => 'Edit',
                'edit_item' => 'Edit Press Coverage',
                'new_item' => 'New Press Coverage',
                'view' => 'View',
                'view_item' => 'View Press Coverage',
                'search_items' => 'Search Press Coverage',
                'not_found' => 'No Press Coverages found',
                'not_found_in_trash' => 'No Press Coverages found in Trash',
                'parent' => 'Parent Press Coverage'

            'public' => true,
            'menu_position' => 8,
            'supports' => array( 'title', 'editor', 'comments', 'thumbnail', 'custom-fields' ),
            'taxonomies' => array( '' ),
            'has_archive' => true

I'm using the roots starter theme. Is there some extra configuration I need to do to make custom post types work with it?



1 Answer 1


All I had to do was go to settings -> permalinks and re-save the structure I was already using.

This seems like a bug in WordPress to me.

Not the answer you're looking for? Browse other questions tagged or ask your own question.