在 WordPress 中迁移小部件设置

2022-01-18 00:00:00 widget settings mysql wordpress

我在工作中和其他地方完成了很多从一台服务器到另一台服务器的 WordPress 迁移,但我一直无法理解的一件奇怪的事情是为什么小部件设置永远不会被继承.

I've done a lot of WordPress migrations from one server to another at work and elsewhere, but one strange thing I've never been able to understand is why widget settings never get carried over.

我将转储 MySQL 数据库,用实时域查找/替换 localhost,将数据库通过 SSH 连接到实时服务器,然后 ftp 整个 WP 安装(核心和主题,从我的本地计算机),仍然是小部件设置被清除.有时,我在仪表板中创建的主题选项页面中保存的值也是如此.

I'll dump the MySQL database, find/replace localhost with the live domain, SSH the database up to the live server, and then ftp the whole WP installation (core and theme, from my local machine), and still the widget settings are wiped out. And sometimes this is also the case with values saved in theme options pages I make in the Dashboard.

我错过了什么?

推荐答案

Wordpress 存储小部件选项 - 一些插件和主题也存储它们的选项 - 作为序列化数据,因此您必须比完整的查找/替换更加小心的网址.

Wordpress stores widget options - and some plugins and themes also store their options - as serialized data, and so you have to be more careful than a full find/replace of the URLs.

更全面的答案和其他一些移动数据库和保留序列化数据的方法:https://wordpress.stackexchange.com/questions/9076/why-is-my-database-import-losing-text-widget-data

Much more comprehensive answer and some other ways to do move databases and retain serialized data: https://wordpress.stackexchange.com/questions/9076/why-is-my-database-import-losing-text-widget-data

相关文章