簡體   English   中英

Wordpress沒有反映數據庫的變化

[英]Wordpress not reflecting changed of the database

當我將網站移動到另一個文件夾(從/ dev /到/)時,我的問題就出現了。 我已經瀏覽了整個數據庫,以便更改所有硬編碼/ dev / into /但我仍然注意到wordpress,不知何故,仍然使用舊值。

基本上,該網站使用的信息不再存在。 我檢查了自己和服務器緩存,它們似乎都很干凈(服務器似乎甚至沒有這個功能)。

所以,我很丟失......

當您移動wordpress安裝時,您需要更改整個數據庫中的站點URL。 為此,您需要通過PHP MyAdmin導出當前數據庫,然后使用如下工具:

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

...在整個數據庫上進行搜索和替換。

搜索:www.yourwebsite.com/dev

替換為:www.yourwebsite.com

然后導入新數據庫,通過wp-admin打開Wordpress站點並重新保存永久鏈接。

在數據庫中運行此查詢

set @oldurl = 'http://oldwp-url.com', @newurl = 'http://newwp-url.com';

UPDATE wp_options SET option_value = replace(option_value, @oldurl, @newurl) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = REPLACE (guid, @oldurl, @newurl);
UPDATE wp_posts SET post_content = REPLACE (post_content, @oldurl, @newurl);
UPDATE wp_posts SET post_content = REPLACE (post_content, CONCAT('src="', @oldurl), CONCAT('src="', @newurl));
UPDATE wp_posts SET guid = REPLACE (guid, @oldurl, @newurl) WHERE post_type = 'attachment';
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, @oldurl, @newurl);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM