WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Type UI
[resolved] Migrate CPT from different theme (6 posts)

  1. KOKOStern
    Member
    Posted 1 year ago #

    Hey there.

    I've been using a specific theme that has built in CPTs (gamepress). I've now switched to a different theme (Responsive), and I don't want to lose all the data.

    I installed CPT UI Plugin and I want to create a CPT with the same name as the old one, and then do whatever is necessary to transfer everything.

    Before I start trying to do this, I wanted to ask if anyone has experience with such an endeavor (couldn't find anything while searching). The way I see it I'll create the CPT in the plugin, then see what it does in the DB (MySQL) and try and change all the old CPT data to match so it'll be part of the new CPT.

    Of course I'm backing up everything before I even try to touch it so no worries there :).

    Anyone got any tips before I dive in?

    http://wordpress.org/extend/plugins/custom-post-type-ui/

  2. Michael Beckwith
    Member
    Plugin Author

    Posted 1 year ago #

    Your custom post type data is still in your database, specifically the posts table, so you don't need to transfer anything. You just need to recreate the custom post type registry to match it. The key will be the name/slug that you give it. You'll want that to match up with the previous one, which looks to be gamepress.

  3. KOKOStern
    Member
    Posted 1 year ago #

    Wrote the exact custom post type name that the old theme created and it caught the correct one, then I was able to change it and edit it without a problem.

    Works great! Thank you! Topic Resolved.

  4. KOKOStern
    Member
    Posted 1 year ago #

    One final question that relates to this subject.

    I got the post type by using the name 'gamepress_video' which is the default name from the gamepress theme. I saw all my videos were there and so I decided to change the name to something more appropriate by editing the CPT. I changed the name to 'videos' and now I don't see my old content anymore. Obviously if I revert back it works, which means that by editing a CPT name I'm just changing the reference and not in the DB.

    The follow-up question is then this - can I change the CPT name in any way or am I stuck with 'gamepress_video'. I know that the labels are what readers see so it shouldn't be an issue, but I'd still like to understand if there is a way to change it within the plugin. I'm assuming no since you don't deal with the DB itself, but if I was to go in and change it all in the DB it should work right?

  5. Michael Beckwith
    Member
    Plugin Author

    Posted 1 year ago #

    Correct, changing the CPT name doesn't change anything in the database, you're more or less creating a new one. You'll need to find a way to change them in the database as well, whether manually or via some plugin that will change the values for you. I don't know any by name, but I've seen people mention some so it's worth searching for.

    That pretty much answered both parts of the question, after reading part two.

  6. KOKOStern
    Member
    Posted 1 year ago #

    Ok thank you, resolved the topic :).

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.