bainternet / Tax-Meta-Class

A class for creating WordPress taxonomies custom fields
http://en.bainternet.info/2012/wordpress-taxonomies-extra-fields-the-easy-way
GNU General Public License v3.0
406 stars 111 forks source link

Site transfer replacing URL in meta_value #119

Closed lexxful closed 8 years ago

lexxful commented 8 years ago

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?

termmeta

Akamaozu commented 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.

lexxful commented 8 years ago

@Akamaozu Thanks a lot for adviсe! I will try this script.