Support » Fixing WordPress » Change custom field value for all posts using phpmyadmin

Viewing 2 replies - 1 through 2 (of 2 total)
  • hi

    BACK UP YOUR DATABASE using phpmyadmin before you run this query

    UPDATE wp_postmeta SET meta_value = replace(meta_value, 'uploads', 'thumbnails') WHERE meta_key = "thumbnail";

    above code is example showing the meta_key name as ‘thumbnail’ – change to your specific meta_key name. It changes the substring uploads to the substring thumbnails in all posts with that meta_key

    query assumes the custom field used has the same key name in all posts, just the value will change. Query limits the replace to rows with that keyname, to prevent unintentionally affecting other keys that were never intended to be changed.

    Thanks for the quick reply this worked perfectly and saved so much time compared to editing each post manually.

    Many thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change custom field value for all posts using phpmyadmin’ is closed to new replies.