[轉貼]WordPress 網域 搬家 網址異動 更新資料庫

wp 網站搬家 需要更新資料庫

UPDATE wp_options
SET option_value = REPLACE(option_value, '舊網址', '新網址')
-- 僅替換與網站相關的條件
WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_postmeta
SET meta_value = REPLACE(meta_value, '舊網址', '新網址');

UPDATE wp_posts
SET post_content = REPLACE(post_content, '舊網址', '新網址');

UPDATE wp_posts
SET guid = REPLACE(guid, '舊網址', '新網址');

 

UPDATE wp_optionsSET option_value = REPLACE(option_value, ‘舊網址’, ‘新網址’)– 僅替換與網站相關的條件WHERE option_name = ‘home’ OR option_name = ‘siteurl’;UPDATE wp_postmetaSET meta_value = REPLACE(meta_value, ‘舊網址’, ‘新網址’);UPDATE wp_postsSET post_content = REPLACE(post_content, ‘舊網址’, ‘新網址’);UPDATE wp_postsSET guid = REPLACE(guid, ‘舊網址’, ‘新網址’);

內容出處: WordPress 網址異動後台設定和更新資料庫 – 腳印網頁資訊設計