I’m Satou, a Web/App/UI designer.
This time, I will write about Better Search Replace, a plugin that allows you to replace strings in DB in WordPress.
Replacement of URLs is required when using Xserver’s working URLs.
The other day, I had an opportunity to use Xserver’s working check URLs for a project.
After creating a WordPress website and setting up the nameservers for the domain, I used it as a confirmation environment until it was reflected.
It was fine up to that point, but after that, when the name server settings were reflected and the website could be accessed with the domain name, it became a hassle.
The WordPress site URL setting had become a working URL.
All the URLs WordPress outputs, including permalink URLs and admin URLs, have become working check URLs.
Of course, all the media URLs are also in the URLs to be confirmed.
Therefore, you can access the website by entering the domain name directly, but when you move to other pages after that, the URL will be the confirmation URL.
Also, if you right-click on the image and open it in a new tab, the URL will be displayed in the address bar of your browser.
Therefore, we have to rewrite every possible string “http://domain-name.check-xserver.jp” in the DB to “http://domain-name”.
Changing “WordPress Address (URL)” or “Site Address (URL)” from the settings page will not change these descriptions, so you need to replace the strings in the DB.
Try “Better Search Replace” plugin for replacing strings in DB
I’m sure many of you have been using “Search Regex” when it comes to string replacement plugins in DB in WordPress.
I am one of them, but “Search Regex” was last updated one year ago, and its operation has not been tested on the latest WordPress.
This is not good.
So I decided to use a string replacement plugin other than Search Regex.
If you search for “database replace” in the WordPress add plugin screen, you will find several plugins.
Among them, I decided to use “Better Search Replace”.
The reason is as follows.
- It appeared first in the search results.
- Last updated 2 months ago and relatively new.
- More than 1 million active installations and many users.
- It had a high rating of 4.5 with 455 ratings.
Run “Better Search Replace”.
Now, let’s use “Better Search Replace” to replace the working URL string in the DB with the official URL.
Better Search Replace” is available in the “Tools” menu of the Administration menu.
Easy to use
Using “Better Search Replace” is easy.
- String to search.
- String to replace the searched string.
- DB table to search.
and execute it.
When executed, the progress bar will extend and
You can see how many replacements were made in which table.
Some options as you see fit
- Case sensitive or not
- whether to rewrite the GUID.
- Whether to run a dry run.
Please select as appropriate.
Whether to be case-sensitive.
Please decide accordingly.
Whether to rewrite GUIDs.
You can leave this unchecked.
GUID stands for Globally Unique IDentifier.
A 128-bit random number that is guaranteed to be unique and not duplicated anywhere in the world. It is used in object-oriented systems to identify objects.
This string doesn’t have to contain a separate URL, but WordPress requires the URL to be included.
There is no particular disadvantage to not rewriting this, and on the contrary, rewriting it may cause some kind of problem, so let’s leave it alone.
Whether to run a dry run (rehearsal).
Use your judgment accordingly.
When run, it will tell you how many strings to search for and in which table.
Search and Replace with Regular Expressions Available in Paid Version
Search and replace using regular expressions is not available in the free version.
If you want to perform more elaborate replacements, you will need to purchase the paid version or consider another plugin.
The paid version has four plans, some with the ability to migrate media files, and some with the ability to migrate theme files and plug-ins as well.
This may be useful for website duplication and server migration.
Simple and easy to use “Better Search Replace”
I was going to try several string replacement plugins in DB before deciding, but the first one I tried, “Better Search Replace”, was so simple and easy to use that I think I’m done with it.
- Case sensitive or not
- Whether to rewrite GUID.
I think that the “Better Search Replace” option is safe and secure, so I think I’ll continue to use “Better Search Replace” from now on.
If you have any other plugin recommendations, I would appreciate it if you could let me know via Twitter.
Well, this time, I wrote about Better Search Replace, a plugin that can replace strings in DB in WordPress.
How was it?
I’m glad if it was helpful for you who read it.
See you next time.