Im storing my images on another server and Ive managed to change the urls in the database but I cant seem to change the featured image urls?
I will not be adding any more images so I just want to change the url for all images.
This is the sql I used for normal images
UPDATE wp_posts SET post_content = REPLACE (post_content, 'src="http://www.oldsiteurl.com', 'src="http://newsiteurl.com');
and
UPDATE wp_posts SET guid = REPLACE (guid, 'http://www.oldsiteurl.com', 'http://newsiteurl.com') WHERE post_type = 'attachment';
All the other images are fine except the featured images.
The featured image is stored in the
*_postmeta
table under the_thumbnail_id
key. In fact, chances are that you’ve got a lot of image/media urls in that table, which you haven’t changed. The problem is that a number of things are stored in serialized arrays and changing them with SQL as above will (probably) break those arrays. I would suggest using something like Velvet Blues Update Urls.It looks like you have changed all of your URLs and not just the image/media URLs. Is that what you intended?
Also, you should never change the guid.
NOTE and EDIT: I just noticed an exception for attachment media in the WordPress Codex. I don’t remember ever seeing that and I am not sure what that is about and I am not sure what to make of that at the moment.