'wordpress image url wrong in database

We have a wordpress website that was migrated over a few months ago and some images are displaying the wrong link still.

For example, one image on a gallery has a url of http://1.1.1.1/~websitename/wp-content/uploads/2015/03/image.jpg and it should be http://ournewwebsite.com/wp-content/uploads/2015/03/image.jpg.

I've changed the post GUID in the DB for one particular post but it hasn't worked, do I need to change some other settings for images?

I've found the issue is in the postmeta table, the images were in a string on these, however there are many that follow this format in HTML, I need to search and replace all instances of just the IP address and not the full path as they're all different...



Solution 1:[1]

Try using this plugin,

https://wordpress.org/plugins/velvet-blues-update-urls/

Update GUID's and urls from old to new.

Solution 2:[2]

As per my knowledge, when wordpress site is migrated to other domain. By changing these two row values in database table wp_options

  1. select option_value from wp_options where option_name="site_url"
  2. select option_value from wp_options where option_name="home"

All rest of urls in database tables will be changed automatically, except urls in post_content column in wp_posts table.

As per your query, above method is not working.

Alternate option: https://wordpress.org/plugins/search-and-replace/

Above plugin will automatically search for given string and replaces. Make sure please take backup of your database before processing.

Caution: Do not change GUID value manually. If it so also, it doesn't work.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Raj Ravuri