dro7152 2016-11-01 17:05
浏览 15
已采纳

Wordpress option_tree覆盖

I'm using Wordpress 4.6.1 with the theme Goodlife.

Whenever I change the domain, my theme loses all settings (theme options).

Analyzing database, I realized that he loses the values changed in "option_tree" option.

To change domain, I use these queries:

UPDATE wp_posts SET guid = REPLACE(guid,'old_url','new_url');
UPDATE wp_posts SET post_content = REPLACE(post_content,'old_url','new_url');
UPDATE wp_options SET option_value = REPLACE(option_value,'old_url','new_url');

I made a simple test to confirm, and copied the value of this option and enter directly into the database. Just that I load the wordpress that the value is lost again.

Now I have the "option_tree" value in a txt file, but the wrong value in the database, how can I use the real value in my website without it being overwritten?

  • 写回答

1条回答 默认 最新

  • drcigvoy48900 2016-11-01 17:28
    关注

    Without seeing exactly how the data is structured, I'd bet 100% that the theme option corruption is due to the search and replace screwing up serialized data. Since serialized data defines the exact length of it's data, a search and replace (unless the before and after terms are exactly the same) can have the effect of corrupting all the data in the field. Most theme options are saved as serialized data.

    Instead of trying to run your custom commands, I've found a LOT of success with this search and replace script meant for this exact purpose:

    https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

    Follow the install instructions and run the search and replace through their tool. It correctly handles serialized data and prevents errors from occurring in the data.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!