0

If you ever want to do a mass find & replace on a repeating field in Toolset, I found a way how. This command works, but I'd like to make sure that I'm not doing anything wonky here.

Let's say you have a field called "wpcf-your-repeating-field-name". In that field, you have a value of "Old value". You want to replace that "Old value" with "New value". With this SQL command, you can replace all instances of "Old value" with "New value" in your field called "wpcf-your-repeating-field-name".

UPDATE 
    wp_postmeta
INNER JOIN 
    wp_toolset_associations 
    ON wp_postmeta.post_id = wp_toolset_associations.child_id
LEFT JOIN 
    wp_posts 
    ON wp_posts.ID = wp_toolset_associations.parent_id
SET
    wp_postmeta.meta_value = 'New value', 
    wp_posts.post_modified = '2019-08-12 14:27:09',
    wp_posts.post_modified_gmt = '2019-08-12 14:27:09' 
WHERE
    wp_postmeta.meta_value = 'Old value'
    AND wp_postmeta.meta_key = 'wpcf-your-repeating-field-name'

This command will also update your post_modified and post_modified_gmt fields in wp_posts.

Is there anything else that should be updated when doing a mass-update to the data created by the Toolset plugin?

closed as unclear what you're asking by Jacob Peattie, fuxia Aug 15 at 20:54

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.