How To Run A Site-Wide Search & Replace On Wordpress
Today’s plug-in was one that, when I found it… I was excited. This was something I was wanting to do on this blog, but thought I would need to manually code it. But, alas… there was no need.
This is Day 18 of the 30 Days, 30 Killer Wordpress Plug-ins Series.
Sometimes you need to do a site-wide search & replace on your site. Fortunately, being that all of the content on a Wordpress site sits in a database, it is pretty easy to do.
As an example, when I converted this site from davidrisley.com to blogmarketingacademy.com, I had a bunch of links to change out. I want to change ALL of my internal links so that they used the new domain.
How did I do it? I used the Search & Replace plug-in.
Here’s what it looks like:
Not exactly non-geeky, but it works. To make the most sense of the interface, you’d need to know the basic structure of the Wordpress database. Then you’ll know what fields are being affected.
It is simple to use. You check off which section of the database you want to run the operation on. You enter your search text – then what you want to replace it with. Then, hit “Go” and it’ll do the job.
Now, two words of warning on using a plug-in like this:
- You have to be very careful what you enter as your search and replace text. It needs to be a direct replacement. This plug-in looks at each database field as nothing but a block of characters. It isn’t going to exercise any judgement as it progresses, so you need to be very sure you enter the fields correctly.
- A plug-in like this can do a lot of damage if you screw it up. It is directly impacting the database fields of your site. It isn’t anything you need to sweat bullets over, but you do need to be careful. And most importantly, you need to BACK UP YOUR DATABASE. Don’t run an operation like this without a backup you can restore if you screw something up.
In my case of changing the links, I chose the “Content” option (since I wanted to replace links within pages and posts). I enter “davidrisley.com” as the “Replace” text, and I enter “blogmarketingacademy.com” as the “with”. This operation would be very precise about replacing all instances of my domains which were contained within link HTML, and anything which came AFTER the root domain in the link would be left untouched.
Other possible uses for it include:
- If you use an affiliate link throughout your site and you weren’t using a redirection plug-in like Pretty Link – and let’s say the affiliate link changed… you could use this to replace the link site-wide.
- Talking about a product on your blog, and later find they re-branded and go by a different name? You can change the product name through your blog.
- Change image URLs if you moved the location of your images (which would otherwise result in broken images all over your site).
You get the idea. Very useful if you’re making structural changes to your site. But, definitely use it with care. And, I’d recommend you de-activate the plug-in when you’re not using it.
——-
Keep up with the latest in this 30-day series by staying connected!
- Follow me on Twitter
- Connect on Facebook – my personal profile or my public one
- Connect on Google+
- Subscribe via RSS
- OR…
You can enter your email below and I’ll keep you in the loop….
[contentblock id=11 img=optin.png]
Got A Question?
Have a question about this article? Need some help with this topic (or anything else)? Send it in and I’ll get back to you personally. I think that’s better than a blog comment. 😇