Closed lexxful closed 8 years ago
@killexx I use https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ to solve the problem of replacing strings in a db migration.
It will be able to replace the string even if were a serialized value.
@Akamaozu Thanks a lot for adviсe! I will try this script.
I have a problem transfering site to another domain. Site has a picture for custom taxonomy.
$my_meta->addImage($prefix.'tax_featured',array('name'=> __('Image for Message Series ','tax-meta')));
While transfering site I replace URLs with this SQL code:
UPDATE wp_options SET option_value = REPLACE(option_value, 'http://old-url', 'http://new-url') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = REPLACE(guid, 'http://old-url', 'http://new-url');
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://old-url', 'http://new-url');
After that - front-end works fine and gets picture normally. But the problem is that Backend has wrong URL and picture doesn't show (404). I've found out that table wp_termmeta still has OLD URLs in meta_value field, and data in this value is a serialized array, so I can't replace URL manually with SQL query.. I've tried that and Wordpress gets empty value in function get_term_meta(...).
Has anyone encountered this problem? Maybe you can suggest a solution for replacing URLs in meta_value?