I know this has been asked a million times but I am pulling out the little hair I have!

I have a custom post type called case-study (case-study.php and then linked in functions), a file called single-case-study.php and setup a post called test but I get a 404 when I go to website/case-study/test. I have tryed flush_rewrite_rules(); in my functions.php and after register_post_type('case-study' ,$args );, I have tried goingt to permalinks in the settings and saving and I have tried changing some of the things in the post register such as hierarchical or has_archive.

I have tried disabling all plugins, basically I have tried everything on this website How to Fix 404 and anything I could find on here. Does anyone know of anything else that could be casuing this?

Here is my register_post_type:

$args = array(
    'label'              => 'Case Study',
    'public'             => true,
    'publicly_queryable' => true,
    'show_ui'            => true,
    'query_var'          => false,
    'capability_type'    => 'page',
    'hierarchical'       => true,
    'has_archive'        => false,
    'rewrite'            => array('slug' => 'case-study', 'with_front' => false),
    'supports'           => array('title', 'editor', 'thumbnail'),
    'menu_position'      => 31
);
register_post_type('case-study' ,$args );

1 Answer
1

Removing 'query_var'=> false solved this. Thanks to @PedroCoitinho

Leave a Reply

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