Custom Post Types are a wonderful feature in WordPress and a great mechanism for customization.

When implementing this feature you may come across a scenario where you encounter a 404 error when reviewing your custom post type on the browser.

The easiest solution that worked for me is the use of the flush_rewrite_rules() function. Just add this function to your code after you register your custom post type(s), ie, after you call the register_post_type() function(s).