WordPress posts and pages are stored in wp_posts table. You may wonder how it differentiates? The post_type column stores the value ‘post’ for post and ‘page’ for page. We can have our own custom post type also. For example if we add custom post type ‘portfolio’ then, what gets stored under post_type column is ‘portfolio’
It’s very easy to have custom post type. But my humble advise is to check twice whether it is really needed? If it is really needed then do go for it, because there is nothing like it, Trust me..!
Instead of dictating everything step by step I will recommend reading codex link for ‘Custom Post Type‘. This will certainly give you up to the mark knowledge about the same.
Solution to 404 issue
Finally I got the solution for WordPress Custom Post Type 404 issue.
After doing a lot of search and banging my head against a wall, I came to know that we can not have a PAGE and CUSTOM POST TYPE with the same name. I repeat, we cant have a PAGE and CUSTOM POST TYPE with the same name. Since, WordPress generates the permalink on the fly as per the name/title of the page we enter while creating, it conflicts with the Custom Post Type. For example if you have page name ‘ Portfolio ‘ please do not make mistake of defining Custom Post Type as
If you do, you will get 404 headache either with your pagination or any links e.g. Read More. So simply make either of the name plural.
Hope this helps, and saves you precious time! 🙂