简体   繁体   中英

Wordpress not reflecting changed of the database

my problems started when I moved my website to another folder (from /dev/ to /). I have gone through the whole database in order to change all the hardcoded /dev/ into / but I still notice that wordpress, somehow, still uses the old values.

Basically the website uses information that are not there anymore. I checked my own and the server cache and they all seem to be clean (the server doesn't even seem to have that feature on).

So, I am pretty much lost...

When you move a wordpress install, you need to change the site URL throughout your database. To do this you'll need to export your current database via PHP MyAdmin, and then use a tool like:

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

...to do a search and replace on the entire database.

Search for: www.yourwebsite.com/dev

replace with: www.yourwebsite.com

Then import the new database, open your Wordpress site via wp-admin and re-save permalinks.

Run this query in your database

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM