Creating a Custom Post Type

You have to flush the rewrite rules of WordPress. You can do it either by going to Permalink Settings and click save or by using flush_rewrite_rules

That’s happens because WordPress doesn’t know the URL-structure of your new custom post type. Read more here: Custom Post Type and Permalink