Custom post type redirect to 404 page in wordpress

Avinash singh | 8:17 AM

Custom post type redirect to 404 page in wordpress

Problem:

When i create my custom post type in functions.php it works for listing the records on template file but when i click the permalink it redirects me to the Page Not Found(404) page.

Solution:

Type this function before your custom post type code  flush_rewrite_rules(true); This will work

Still if you are getting problem then go through the below points:

In certain case this happens due to some existing plugin which restrict this.
 To overcome from this problem just install a plugin to create custom post type.
 and create the post with the same name which you have created in functions.php
e.g : news_article and after creating this post type via plugin, now you can delete the function from functions.php

This works for me . Try this also help you :)

Avinash Kumar Singh © 2013. All Rights Reserved | Powered by-Blogger