Jens Wedin
Member
Posted 2 years ago #
Hi
I'm trying to search and replace some data in the custom fields.
I'm having a custom field key called 'top_photo_url'
The value of the custom fields contain '/wp-content/uploads/image.jpg'
I want to remove the 'wp-content/uploads/' in only this specific key.
Is that possible with a sql query?
Jens Wedin
Member
Posted 2 years ago #
So to answer my own question for the future, this is what I wrote, please note that the backticks are WRONG.
UPDATE 'wp_postmeta' SET 'meta_value' = replace(meta_value, '/wp-content/uploads/', '') WHERE 'meta_key' LIKE 'top_photo_url'
I got the code examples from this site
http://brockangelo.com/2009/03/18/search-and-replace-a-custom-field-in-wordpress-using-phpmyadmin/