Quickly change multiple posts in WordPress

25 October 2007 · 0 comments

There are a few things that I find so useful and valuable I recommend them whenever I have the chance. Occasionally those services provide opportunities for an affiliate link, like ScreenCastsOnline. Because I may earn a few cents and would recommend them anyway, I take up the offer. Then, once in a while, they change [...]

 

There are a few things that I find so useful and valuable I recommend them whenever I have the chance. Occasionally those services provide opportunities for an affiliate link, like ScreenCastsOnline. Because I may earn a few cents and would recommend them anyway, I take up the offer.

Then, once in a while, they change things around and I have to change the link I use. That happened today.

First I went to my blog’s theme and updated the sidebar. That took only a few seconds, but I also knew I’d mentioned the link in an unknown number of my 2177 posts to date. Changing those links was another matter entirely.

List of found posts in CocoaMySQL-SBG. Some people would go to PHPAdmin, in their web host’s Control Panel, but instead I started up a wonderful piece of free software called CocoaMySQL-SBG (for Macs). I’ve used this before so everything was all set up. I connected to my blog, selected the wp_posts table and clicked on the content tab. Then I selected post_content and contains from the pop-ups, entered a search term and clicked the search button. After a few moments 11 posts were identified as potential candidates for link changes.

Editing a post in CocoaMySQL-SBG. To change the links I then selected each post in turn and double-clicked on the post_content field. Then I could scan the text, make any necessary edits, and close. When I clicked on the next row the edit was written back to the database on the server.

It took only a few minutes to change all the relevant links. Of course, if I felt more confident about MySQL queries, I’m sure I could have written a query to do it. But this method worked well for me.

Interestingly enough, this process threw an error for one particular post, advising me that I needed to repair the database. I backed up the database, then clicked the Optimize Table button on the CocoaMySQL-SBG toolbar. That seemed to fix things.

For full details of how to set up CocoaMySQL-SBG see Chapter 10 of the WordPress 2 Visual Quickstart Guide that Maria Langer and I wrote last year. In short:

  1. Enable access to the database.
  2. Open CocoaMySQL-SBG. The New Connection sheet appears.
  3. Enter the same Host, User and Password details as you entered in the wp‑config file when you installed your blog.

For Windows users — we explain in Chapter 10 how to work with a similar program, SQLyog for Windows.

Be the first to comment ⇒

These Posts may interest you too:

  1. Change the default links *before* you install WordPress You can change the default text for a new install of WordPress if you just know where to look. This Post explains where to find those defaults. ...
  2. WordPress behind the scenes One way to really take charge of the database behind the scenes of any WordPress blog is with software that interacts directly with it. ...
  3. Move a WordPress blog to a new host I’ve been moving The Groupings WordPress blog from one host to another. It’s surprisingly simple, but there were a couple of glitches. The blog has about 70 posts, half a...
  4. How to use Google Maps with WordPress It can be frustrating trying to use Google Maps in a WordPress Post. Here's the easy and effective method I found. ...
  5. Missing posts Hmmm, three posts I made with NetNewsWire are in the database, available for editing, but refuse to show up. They’re marked “Publish”. This post comes from the web interface. What...

Tell us what you think.
Note: there may be a delay before your comment appears. I now approve all comments from new visitors, in an attempt to keep spam at bay.

Add your Comment

Previous post:

Next post: