Quickly change multiple posts in WordPress

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.
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.
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:
- Enable access to the database.
- Open CocoaMySQL-SBG. The New Connection sheet appears.
- Enter the same Host, User and Password details as you entered in the
wp‑configfile when you installed your blog.
For Windows users — we explain in Chapter 10 how to work with a similar program, SQLyog for Windows.
Customize WordPress by integrating other apps

The fifth article in my Customizing WordPress series has been published today — Customizing WordPress: Integrating Other Apps:
You don’t have to do all of the hard work creating your blog yourself. For some tasks, you can let other programs do the heavy lifting. You can, for example, use Gallery to handle photos or BBPress to manage forums.
This article explains how to integrate WordPress with the Gallery application as an example of how to take advantage of other programs while building a blog in WordPress.
For some reason the screenshots aren’t showing up at the moment, but I hope we can get that fixed soon. In the meantime, they are available in my Gallery of screenshots.
Troubleshoot broken images

A friend emailed to say she’d installed a WordPress plugin to make it easy for visitors to add her site to various social sites such as Digg and Del.icio.us. But, there was a problem:
You will see that I have got half way towards adding links to four social bookmarking sites — except unfortunately I don’t see an image! Clearly I have put something in the wrong place.
I viewed the source of my friend’s page and located the URL for one of the images: http://www.example.com/blog/wp-content/plugins/social_bookmarks/delicious.png
I pasted that URL directly into the browser and found there was no image. Then I checked the plugin’s page at WordPress, which led me to a support page.
Apparently the plugin has an error in the pathname. The underscore in the social_bookmarks folder name should be a hyphen: http://www.example.com/blog/wp-content/plugins/social-bookmarks/delicious.png
The solution turns out to be: either rename the folder to have a hyphen or change the plugin as explained on the support page.
If you find images missing and unaccounted for try viewing the source of the page and paste the image’s URL directly into the browser. If it displays that way then there’s something wrong with your page. If it doesn’t show up there either, then there’s probably something wrong with the pathname or filename.
Customize WordPress: Pages and Posts

My latest WordPress article has been published at Peachpit: Web Design Reference Guide: Customizing WordPress: Pages and Posts:
While posts make the blog, pages can transform your WordPress site into a full-fledged content management system. This article explains how to use some fundamental features of posts and pages in WordPress.
…WordPress gives you so much power over pages that some people use WordPress not for blogging, but rather to create content management systems (CMS).
The next article should appear in about a month.