WordPress Replace URL or Text in all Posts

In the following simple solution, I will show you how to replace all global occurrences of a URL link (or any other text) within your WordPress post content using SQL Search and Replace Query from phpMyAdmin. This is useful if you need to change a link or text that might appear in more than one post, without going in and manually editing each post by hand to reflect the new link or text.

Change URL or Text in Post Content Globally using phpMyAdmin

  1. Login to phpMyAdmin and select your database
  2. Click the SQL tab
  3. Enter the following in the run SQL Query text box (replacing http://oldlink.com and http://newlink.com with your url*:
    UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://oldlink.com', 'http://newlink.com');
  4. Click Go to process the changes and update your SQL database

That's it, the URL or Text should now be replaced with the new URL or Text , on any post it was present.  A simple way to replace multiple occurrences of text or a link globally using SQL Search and Replace.

*Note: You can also enter the exact text you wish to replace instead of a URL, but be careful, as any occurrence of this text within any of your posts content will be replaced.