Moving custom field data to CustomPress field

On a project I started entering data into custom fields, but then I started using CustomPress.

There is still one meta key that contains information on about 50 posts and was not created by CustomPress; I would like to move the data from there into a CustomPress field to simplify the UI for my clients.

What is the best method to do this?

PS: I’m not afraid of custom PHP or SQL queries.

  • Arnold
    • El Macho WP

    Little complicated but you can sort of do it. The complication is that All custompress field ids start with either “ct_” or “_ct_”. If you can stand that

    Make a CustomPress custom field the way you want it.

    Use export to export the field definition.

    Hand edit the field id to match the field id you already have

    Delete the original CustomPress Custom field and reimport it with the new field ID.

    Then in SQL with phpMyAdmin or equivalent rename the old instance to the new field id with ct_ in front

    UPDATE wp_user_meta SET metakey='new_field_id' WHERE meta_key='old_field_id'

    Done right it should automatically pick up you current field.

    Do backups and all that good stuff be fore trying.

  • adaldesign
    • The Incredible Code Injector

    Just for the sake of the forum, here’s what I ended up doing:

    – Created a new field in CustomPress,

    – Simply ran this query:

    UPDATE 'wp_10_postmeta' SET 'meta_key' = REPLACE ('meta_key', 'CSS_thumb-position', 'ct_Thumbnail__text_de1a');