Support » Plugin: Post Type Switcher » Converted post not using custom post slug

  • Hi guys, great plugin.

    One thing you can perhaps help me with…

    I have am using a plugin which creates a custom post type ‘dowpp_place’. In register_post_type I set a custom rewrite slug ‘places’. So a new ‘dowpp_place’ post shows up at ‘/places/some-slug’.

    I’d like to convert some existing posts to this type, using your plugin. The conversion works, but the post remains accessible at ‘/old-slug’ rather than ‘/places/old-slug’.

    The problem I have is that when using site search, etc, the post link is now using the custom slug ‘/places/old-slug’, which just points to a 404 page. So converting the post breaks existing links and search listings.

    My guess is that when your plugin converts the ‘post_type’ value it doesn’t update the post slug rewrite value to that of the custom post type.

    Do you know any easy way round this, short of going digging in the code / db myself in order to update the rewrite slug?

    Hope that all makes sense.

    Cheers, Dan

    https://wordpress.org/plugins/post-type-switcher/

Viewing 1 replies (of 1 total)
  • I’ve fixed the problem in my own case by setting the rewrite slug on my post to be ‘/’. This means that my custom posts don’t have a slug at all, and now show up at ‘/old-slug’ the same as a regular post. Since the permalink doesn’t change when I switch post types everything works correctly.

    My issue is resolved, so feel free to mark the thread as resolved. But I’ll leave it open in case you want to add any comments for people who need to keep the slug base.

    Thanks,
    Dan

    P.S. I’ve written up some notes on removing the custom post slug for anyone trying to do the same thing.

Viewing 1 replies (of 1 total)
  • The topic ‘Converted post not using custom post slug’ is closed to new replies.