How to Bulk Replace Links in WordPress?

Andrey Novoselov Andrey Novoselov
Reading time:  3  min.

Need to replace many links on your website at once? Don’t worry, this routine task can be automated. Here you will learn how to do it quickly and easily. 


Webmasters don’t like to concern themselves with routine work, in particular the one giving no immediate satisfaction. No doubt, bulk change of links on the website is one of them: though it is done not so often, only some of them are satisfied with the prospect of killing their time on the change of hundreds of URLs by hand.

However, if you really have to do it (when moving to a new domain, or, for example, you want to replace the existing links with Travelpayouts URLs), don’t worry. Feel free to turn this task over to a soulless machine. How? Read our selection of TOP 3 most convenient ways to do it!!

#1: MySQL Query

This is the easiest and universal recipe for a quick change of all links on your website involving a direct work with MySQL database (unless you use this system).

Your actions are as follows. First, sign in to phpmyadmin, find your database there containing “wp_posts” table (if you are using WordPress) with the “X” field storing the URLs. Then, you should open the SQL tab and execute the following query:

UPDATE wp_posts SET Х= REPLACE (Х, “an old link”, “a new link”)

Now you have just to click “Go” (or a corresponding icon, if your interface differs). It’s a done deal!

#2: PHP Script Upload to the Website

Bulk link change is a well-known issue. No wonder that ready-made solutions have been already provided: Search and Replace script by the Interconnect Company. Though it has been initially created for WordPress, it is applicable to other popular CMS (such as Drupal or Joomla).

Its use is simple as falling off a log: download zip file using the link above, extract the search-replace-db-master folder (for ver. 3.1.0), rename it if needed and upload via ftp to a public directory of your hosting (but not in the website root, remember it!).

Back up your database (never, never forget to make a backup!) and open the uploaded folder on your server via your browser’s address bar. The script launches automatically, so you will have only to choose the database and links you are going to replace.

#3: Better Search Replace Plugin for WordPress

find and replace wordpress

Hate to upload other people’s scripts to your website? We know it, so we’ve got an alternative for the owners of WordPress websites. Perhaps, this CMS has the most convenient plugin for bulk link change – Better Search Replace. It is easily integrated, compatible with any hosting (according to its developers), and seems perfect for work with WordPress Multisite.

Everything is quite simple. For example, when moving your site you’ll have to do the following: firstly, it is necessary to integrate the plugin and make a backup of the database (obligatory!), as well as to install the database and engine on a new hosting. Then you should specify a new URL in wp-config.php (learn more about it here), log in to the admin panel of the new website and launch Better Search Replace to replace old URLs with new ones.

And it’s almost fixed – now you have just to remove the changed parameter site_url from wp-config.php and generate a new .htaccess file (via Settings-Permalinks in WordPress admin panel) if needed. And don’t forget to back up your database each time you work with it, unless possible errors caused by plugin customization can kill your website!

#4: LinkSwitcher by Travelpayouts

If you decide to monetize your travel website and need to turn your existing links into affiliate links, take advantage of the Travelpayouts LinkSwitcher. Simply add this script to your website and all your links to the websites of Travelpayouts brands will automatically turn into affiliate links.

As a result, all clicks and reservations will be taken into account and a commission will be charged to you. In our Help Center, you can find step-by-step instructions on how to run the script. To start using the script, you need to be registered at the Travelpayouts partnership platform first. 

If you don’t have an account yet, sign up at the link below to gain access to simple, native, helpful tools, including LinkSwitcher. After registering on the Travelpayouts platform, you will be able to earn via travel affiliate programs by working with over 100 well-known brands, such as, TripAdvisor,, and more.

Join the Travelpayouts Partnership Platform

Access exclusive tools and the best travel partner programs, including flights, hotels, car rental, insurance, tours and activities, all in one place.

Join Today
480,000 partners already trust us
$63M+ total paid since 2011
60+ travel brands


However, if you still doubt about your abilities and skills, you’d better find a specialist. This will help you avoid possible problems with your website, thus preserving your time, money and efforts.

P.S. We’ve got great news for those using our plugin for WordPress: we are planning to enrich its basic functionality with one more function – bulk link change. The work … is in full swing!

Use the Google docs leak to benefit your blog. Check out the tl;dr with SEO tips