Theme Raid / Articles & Tutorials

How to Fix Custom Post Type 404 Error

Simply add after registering the post type in the function file, add the below line of code; this will magically fix this WordPress problem.

flush_rewrite_rules();

Example :

register_post_type( ‘freebies’, $args );

flush_rewrite_rules();

 

Note : Make sure your page template for this custom type is not the same as that defined in the register post type.
for the above example : dont use freebies.php for your page template


We always add new freebies, click like below to keep updated