Moving posts between CPT

This topic contains 6 replies, has 3 voices, and was last updated by  Alex Rollin 4 years, 5 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #521189

    adminparentland-pt
    Expired Member
    Post count: 172

    Hi,

    I want to move all posts from one CPT to another. Tried this:

    https://wpgeodirectory.com/docs/core-export/#tips

    (left ID unchanged, updated post_type, default_category, package_id and post_category according to packages and categories on target CPT)

    Categories show correctly on backend list, but not when I edit the posts (empty), location gets lost and the import is getting stuck in the middle.

    I checked the database and even those posts which appear on the backend as in the new CPT remain in the previous SQL table.

    Re-importing (deleting the IDs) seems to work, but then I will lose the relationships for translations and franchise.

    How about copying the data on SQL directly? What is the risk and which tables should I touch?

    Can you please help?

    #521201

    Alex Rollin
    Moderator
    Post count: 27815

    Yes, ID must be removed, and there isn’t a way around it. We do not provide support for direct-to-database imports.

    If the linked posts are linking TO the one you are moving, then yes they would need to be created, along with the franchise links.

    #521207

    adminparentland-pt
    Expired Member
    Post count: 172

    Then it seems the documentation is wrong:
    https://wpgeodirectory.com/docs/core-export/#tips

    Just to be clear, please confirm if this is what I should do:
    1. Delete translations (to avoid duplication of posts)
    2. Import listings (without ID, updated categories to new CPT)
    3. Create franchising links
    4. Translate (WPML)

    Seems like a very fragile process…

    #521296

    Kiran
    Moderator
    Post count: 7069

    Hi adminparentland-pt,

    All CPTs has different database table to store data apart from wp_posts table.

    For example:
    – gd_place posts data saved in wp_geodir_gd_place_detail table.
    – gd_event posts data saved in wp_geodir_gd_event_detail table.
    – gd_hotel posts data saved in wp_geodir_gd_hotel_detail table.

    If you want to move all gd_place posts to under gd_hotel then you have also move data from wp_geodir_gd_place_detail to wp_geodir_gd_hotel_detail. Make sure both CPTs has same fields in table.

    Most easy way to move posts from one CPT to another CPT is export/re-import.
    – Export posts from CPT which want to move
    – Edit CSV file
    — Make blank post_id
    — Change post_type
    — Set correct default_category & post_category of the new CPT
    – Re-import

    Regards,
    Kiran

    #521298

    Kiran
    Moderator
    Post count: 7069

    Hi adminparentland-pt,

    We have fixed issue of importing and linking translated listings to original listing. It will be in next release of GeoDirectory Multilingual plugin.

    – Download and upload development version from https://github.com/AyeCode/geodir-multilingual
    – Follow instructions given here https://wpgeodirectory.com/support/topic/imported-languages-via-csv-are-not-automatically-linked-to-original-language/#post-512633

    Let us know.

    Kiran

    #521748

    adminparentland-pt
    Expired Member
    Post count: 172

    Hi,

    I suppose I need to delete the post_id first of all. If so, how is the wpml_translation_of column suppose to know to which post_id to relate to?

    Should I first import the original language (in order to create the new IDs) and then (somehow) lookup the translation to fill-in the wpml_translation_of column?

    Please help!

    Thanks

    #521830

    Alex Rollin
    Moderator
    Post count: 27815

    Yes

Viewing 7 posts - 1 through 7 (of 7 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket