Custom Post Type pages are “not found”

I’ve created two new Custom Post types using code that I’ve used successfully on other projects without issue. The first is called top_charts, the other case_studies, and both appear correctly in the admin menu and I can create new posts.

Unfortunately the new posts don’t appear. I just get a 404.php response.

I’ve created an archive-top_charts.php to see if I can get anything to appear, but I see a 404.php “page not found” reply.

I originally named the custom posts top-charts and case-studies, but I thought the hyphen might have been the problem, and so renamed them to use an underscore instead. It hasn’t helped.

I’ve tried re-saving my Permalinks, but nothing has changed. My .htaccess page looks like what you’d expect, too (and other pages works fine). What else can I check?

5

For fixing custom post not found please use below code in your functions.php:

flush_rewrite_rules( false );

You should only do this as a temporary measure otherwise it will run on every page load.

For more details please follow this link

As for the archive-top_charts.php not appearing, make sure you have 'has_archive' => true when you’re registering your post type.

Leave a Comment