Home > OS >  I've migrated my WP site but can't update img links
I've migrated my WP site but can't update img links

Time:06-14

I have migrated the site and all the images are in the expected folders (these are discoverable). I need to change the links from to newsite.com/ but whatever I do they're still pointing to old-site.com/.

Using Wordpress, Beaver Builder.

Things I have tried:

Ran the following query on my database:

UPDATE wp_posts SET post_content=(REPLACE (post_content, 'old-site.com','newsite.com'));

and

UPDATE wp_posts SET guid=(REPLACE (guid, 'old-site.com','newsite.com'));

and the following, which resulted in an error because there's no such column as meta_value

UPDATE wp_options SET option_value = replace(meta_value,'https://old-site.com/','https://newsite.com/');

Used Beaver Builder to re-save images individually. They appear correctly with the new url, until the page is refreshed.

Re-saved Permalinks.

Purged the SG Cache.

Cleared cache at Settings > Beaver Builder > Tools

Hard refresh. Cleared browser cache. Incognito browser.

Added the following to wp-config.php:

define('WP_HOME','https://newsite.com/');
define('WP_SITEURL','https://newsite.com/');

There are no posts in the database still pointing to the old url. The images are not referenced in the theme files or styles.

I have hundreds of images so any help would be greatly appreciated, thanks!

CodePudding user response:

I have had the same problem, finally I was able to solve it by doing a complete migration with the plugin "WP Migrator", since then all my links are detected and I don't use any other method anymore.

I hope it works for you.

CodePudding user response:

I think first thing you need to identify the images including page is coming from cache or from user server(same-origin). Check with Chrome Developer tools.

Inspect > Network > Check you page url > check header response > server

enter image description here

If from cache-server like 'cloudflare' or cf-cache-status: HIT status found you need to clear the cache. It will different depending on your hosting provider or which cache you used.

If not, check on the MySQL DB again with such follwing query in each table -

SELECT * FROM wp_postmeta WHERE meta_value LIKE "%old-site.com%"
SELECT * FROM wp_posts WHERE post_content LIKE "%old-site.com%"
SELECT * FROM wp_posts WHERE guid LIKE "%old-site.com%"
SELECT * FROM wp_options WHERE option_value LIKE "%old-site.com%"
  • Related