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
- Login to phpMyAdmin and select your database
- Click the SQL tab
- Enter the following in the run SQL Query text box (replacing http://oldlink.com andÂ http://newlink.com with your actual information *:
UPDATE wp_posts SET post_content = REPLACE (post_content, ‘http://oldlink.com’, ‘http://newlink.com’);
- 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.