post-page

Making Site Wide Changes on Your WordPress Blog

16
responses
by
 
on
January 22nd, 2010
in
WordPress, WordPress Plugins

Last week I wrote up a post to review the Real-Time Find and Replace Plugin and the comments on that story about other methods to make site wide changes permanent sent me in search of another way to search and replace information in my SQL database.

Now I consider myself pretty decent at geeky things but directly editing and messing with my site’s SQL database does not top my list of things to do.  Neither does manually going through nearly 1,000 postings to make changes.

What I found was a terrific plug-in that lets me perform a few different functions to make corrections or change info throughout my site.

Caveat: Before I get started – this plugin does make changes to your database. Play it safe and back up your info to protect your original data.

With that said let me now introduce you to the Search Regex Plugin written by John Godley.

The author provides the following description in the WordPress.org Plugin Directory:

Search Regex adds a powerful set of search and replace functions to WordPress. These go beyond the standard searching capabilities, and allow you to search and replace almost any data stored on your site. In addition to simple searches you have the full power of PHP’s regular expressions at your disposal.

The plugin is currently at version 1.4.9 and is dated from July 2009 however it is fully compatible with WordPress Version 2.9.1.

So once you have downloaded and installed the plugin head to the Tools menu in the Admin interface:

searchregex

Click on Search Regex to get to the main admin page:

searchregexmain

From this spot you can either Search; Replace or Replace and Save. Only the last one makes permanent changes to your database when you push the button.

Lets review the options you can set for each one:

Source Dropdown Menu lets you pick the areas in the database that will be searched.

searchregexsourcedropdown

Limit to Dropdown Menu restricts the number of entries that will be searched. This can be handy on a large site.

 searchregexlimitodropdown

Order By lets you choose to display the results of a search in either Ascending or Descending order.

Once you make those choices you are ready to search.  Type the phrase you want to find in the Search pattern box. I found that multi-line searches do not work so well with this plugin so I recommend you keep it short and exact.

If all you want to do is find a handful or articles that have a certain phrase or word in them then click the Search button and you will see the following type of results:

searchregexresultssearch

Each entry is on an alternating color line and if you look all the way over to the right on each line there is a link to either View the post as it appears on your site or Edit the post using the normal WordPress Edit screen. No changes are made to your database by using the Search button.

The next button you can use is the Replace button and this one lets you preview the changes that would be made for each entry that matches your search and replace criteria. Those results show up like this:

searchregexreplaceresults

Just like with the Search button results, if you look over on the right hand side you will see links to either View the post, perform the Replace function for that entry only or open the post up using the standard WordPress admin edit screen. If your only making a few changes this is very handy to do them one at a time to make sure your changing the info you want to change.

The last option you can use is one of the most powerful because it makes the change after you press the Replace and Save button.  With this one you want to make sure the edit is exactly what you want to do.  I recommend using the Replace button first to preview the matches it finds before executing the Replace and Save.

I do not have a screen shot to show you that function because honestly I do not have a change to be made right now. However, the results page looks a lot like the Replace results except they have been made instead of just displayed for review.

So there ya go – a very powerful tool in a small package.  Let me close by repeating an earlier reminder – back up your database before executing any major changes using this plugin. You will be thankful that you did if you hit the wrong button :-)

So which do you prefer – this permanent change or the on the fly changes that are made by the Real-Time Find and Replace Plugin?

heading
heading
16
Responses

 

Comments

  1. Ed Nailor (2 comments.) says:

    This sounds like a very cool tool! I think I will have to give it a try, as this seems so much easier than trying to do this in myAdminPHP. Thanks for sharing this, and tweeting it!
    Ed

  2. Paul Sanduleac (1 comments.) says:

    I will surely ave to check this one! Thanks!

  3. Mark (1 comments.) says:

    this is a difficult one – am considering using these to remove the requierd tags for Vipers Video Quicktags plugin seeing as WP 2.9 now automatically displays stuff but dunno if i have full faith in 2.9’s abilities in this area.

    • Richard Hay (32 comments.) says:

      Well you could always just do a small number of the update and see how that works on some posts. Then you can go from there to remove them all if it works.

  4. C Murphy says:

    Hi –

    I am getting an error message when I try to SEARCH:

    Fatal error: Class ‘stripslashes’ not found in /xx/xxxxx/public_html/wp-content/plugins/search-regex/search-regex.php on line 51

    • Richard Hay (32 comments.) says:

      I am not getting that error but am getting a blank page in IE and Safari. I think something in the update yesterday has messed some things up.

      I will ping the author and see if he can check it out.

  5. Len (24 comments.) says:

    For permanent changes SQL queries are the way to go. Having said that I can see how many bloggers would be terrified to go that route. (and if you don’t know what you are doing you shouldn’t either) Therefore I can see this plugin becoming very popular.

  6. Richard Hay (9 comments.) says:

    Just today the author has updated the plugin.

  7. gestroud (4 comments.) says:

    There’s also the convenience factor. It’s often a bit easier and faster to make changes using a plugin than logging into your web host’s admin panel, going to phpmyadmin and making the changes from there. You also need to ensure that you’re executing the queries correctly. One bit of wrong code, and KABOOM!

  8. robert@trupela (2 comments.) says:

    In my books Search Regex by John Godley definitely wins hands down!!

    Robert

  9. Oliver (2 comments.) says:

    That’s pretty awesome! I think that it would be great for mass changing adverts across your blog etc! I think I’ll be checking this one out! Cheers :)

  10. C Murphy says:

    hi – I upgraded to version 1.4.11 and it works. great tool – thank you!!



Obviously Powered by WordPress. © 2003-2013

page counter
css.php