Home Forums Backend Issues (wp-admin) Migrating from regular field to repeater field


Migrating from regular field to repeater field

    • SoWhat

    • January 16, 2021 at 10:26 am


    I had a simple field findings_description
    After a while I decided to wrap that field into a repeater called examinations.

    To migrate all existing fields to the new structure, I wrote two SQL queries:

    UPDATEwp_postmetaSETmeta_key= '_examinations_0_findings_description' WHEREmeta_key= '_findings_description'
    UPDATEwp_postmetaSETmeta_key= 'examinations_0_findings_description' WHEREmeta_key= 'findings_description'

    To my surprise, this does not work. The field in repeater stays empty even though the db entry is set.

    What am I missing here?

  • You need to set the repeater field to have one row. The meta key examinations needs to hold the number of rows in the repeater and _examinations needs to hole the field key of the field. These 2 rows would need to be added for every post where the repeater appears.

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.