How to Update WordPress Links
Best practices is to develop a site on a development environment and then copy the site to a production environment. When you do this with WordPress, there are a number of settings that you need to update. Most of these, you can update in the settings and appearance panel. If, however, you have uploaded images on the development environment, you will need to make sure your images are being pulled from the production server, not the development server.
To do this, you will need to find the table where the files are listed. (For me, it was wp_posts, and the `guid` column.) Then perform a query on the column to update the links to a new link.
Here’s the code:
UPDATE table_name
SET `column_name` = REPLACE(`column_name`, 'old_value', 'new_value')
WHERE `column_name` LIKE '%old_value%'
Note the last line has ‘%’ as wildcards, which is important when using “LIKE” as an operator. The trick works like a charm.