Matt Jo
Member
Posted 12 months ago #
I got a tricky question about the Custom Post feature in WordPress. Let's say I have a post already and the URL is wegotthiscovered.com/movies/avatar-review
Now let's say I create a custom post type a few days later called Film Reviews and I change the post type of the Avatar review to a film review. When I do that, the URL also changes to wegotthiscovered.com/film-review/avatar-review and when I try to view it, it gives me a 404.
Is there anyway to switch a posts' post type without changing the URL?
Jeremy Boggs
Member
Posted 12 months ago #
It sounds like your rewrite rules need flushed. Try just going to Admin > Settings > Permalinks and saving that form again as-is, then try reloading your 404'd post. It should work after this.
If you'd like all your Film Review post types to use 'movies' as their rewrite base, you can specify that in your register_post_type function. See the URLs section of the Post Types page for some details on this.
Having only some Film Review posts use one url base, and others using a different base, is a bit more complicated.
Matt Jo
Member
Posted 12 months ago #
Ya the flushing worked but now the old link doesn't work. I need to make it so I can switch the post type while still keeping the same URL. How do I find that rewrite base part? Which file would it be in? I'm using a pre-made theme I bought off of Theme Forest, which file would it be in?