Wordpress - Custom Post Type pages are "not found"

You don't have to edit your php code!

While you can do this in the function that registers your custom post type, like the other answers, you can also do this in the settings menu, thus avoiding touching your php code:

To flush WordPress rewrite rules or permalinks (usually needs to be done manually for new custom post types) from the Dashboard:

  1. In the main menu find "Settings > Permalinks".
  2. Scroll down if needed and click "Save Changes".
  3. Rewrite rules and permalinks are flushed.

It's that simple!

image of saving permalinks page reference


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.