I use an automatic post importer in WordPress and add the images in post content with the external URL, I want to replace the link with the local site links.

DB function could do the trick.

eg: oldlink.com replace with newlink.com

Note: there is a 5K images in that way and need to be changed.

I have try to use search replace but not work because changing the externalk URL in the post content winch is I want to keep it. So the tick is to replace only the link with tag

Thanks for your help in advance

1 Answer 1


I was fixing image URLs in my posts with the next SQL-query

UPDATE wp_posts SET post_content=(REPLACE (post_content, '<old url>','<new url>'));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.