Tip for merging two WordPress blogs

WordPress’ built-in export/import functionality makes it a snap to merge two blogs into one. You simply export from the blog you’re going to retire, import into the blog you’re going to keep, and then forward the old domain to the new one.

Here’s my tip: do not select an existing blog user to “own” the imported content! Instead, create a new temporary user just for that content. Here is why: the imported posts may need some manual cleanup, like integration into the new blog’s category structure, or adding/removing tags. By importing into a new author, you’re creating a way to view only the posts imported in that batch. Simply go to the Users → Edit screen and then click the number of posts next to the temporary import author. Boom, you’re looking at only the imported posts. Then, as you clean up their categories and tags using 2.7’s bulk edit or quick edit features, you can simultaneously reassign the posts to their proper author. Once there are no more posts for that temporary import author, delete that author, and you’re done!

Google Gears now supports Safari on OS X

You know that “Turbo” button in the upper-right corner of WordPress 2.6 (and WordPress.com)? That button uses Google Gears to store static WordPress admin files locally, speeding up your WordPress admin experience. Until now, Gears was only available to people running Firefox or Internet Explorer. As of today, people using Safari on OS X can also play. I just activated it for this blog, and it worked without a hitch!


My wife Sarah and I were in Wal-Mart last night, when we saw someone walking around with a shirt that said “Girl’s go’in wild.” We had a good chuckle over the atrocious and arbitrary punctuation. Then I thought “hey, this might make for a good blog.”

4 hours later, Wordsplosion was online. It’s pretty amazing that you can go from idea to execution in a matter of hours using WordPress. Wordsplosion showcases “the best of the worst of the wide world of words.” It contains (and will continue to contain) all manner of grammatical errors, punctuation gaffes, misspellings, horrible typography, etc. It’s LOL cats for smart people.

I used the amazing Journalist theme as a base. Go check it out!

Preview: Advanced WordPress @ BlogOrlando 2008

I’ll be at BlogOrlando on September 27th leading a session on Advanced WordPress. Here’s a quick preview of the topics I’d like to cover:


An overview of the best ways to scale WordPress to withstand any Digg onslaught. We’ll talk about WP-Super-Cache, Batcache and PHP opcode caches. We’ll identify common performance bottlenecks. For more detailed and generally applicable information, you’ll want to stick around for Alex Rudloff’s session on scaling!


Still using FTP to upgrade your WordPress blog? FTP is for your grandmother. We’ll talk about using Subversion to make upgrades happen in a flash.

Advanced URLs

Want a feed of all posts by guest authors on your blog that are in the “Florida” category and also mention “Disney” ? Pfft, that’s nothing. Learn how to use WordPress URL tricks to offer extremely customized feeds to your readers.

Multiple loops

Let’s use the tricks you learned above to create a secondary loop in your theme, without disrupting the main posts loop.

Bring Your Questions!

The format will be conversational, so please bring your Advanced WordPress questions!

How to write a solid and stable WordPress plugin

The b5media tech team was having a discussion today about what criteria we use when reviewing a WordPress plugin for possible inclusion on one of our sites or across our network. It makes for a good list of what to do (or not do) when writing a WordPress plugin, something that might be generally useful to plugin authors. These things won’t make your plugin good — they’ll just help make it secure and stable.

Don’t ignore security

WordPress plugins have unlimited power, which is a blessing (it makes WordPress very flexible), but it can be a curse if your plugin is not code with security in mind. If things like CSRF, the prepare() method (SQL injection protection), XSS are not intimately known to you, it’s time for you to do some research. When someone installs their plugin, they are potentially putting their site’s security in your hands. Rise to the occasion.

Make proper use of the role/capability system

WordPress controls admin access using a roles/capabilities system. Make sure your plugin is checking against an appropriate capability. If it is the sort of thing that only “admins” should use, you should be checking against the manage_options capability. If this is something that an author should be able to do, you might use the publish_post capability. Do not check against roles. Roles are only containers for capabilities, and you can’t assume that an “author” on one blog means the same thing on all of them.

Use current API functions

WordPress has a lot of legacy code and deprecated functions. We try not to break stuff without good reason, so often times we’ll leave in compatibility for old API functions. If your plugin is using these functions, it tells me that you’re not up on current WordPress development. This means that your plugin might be more likely to break with a WordPress upgrade, and it suggests sloppiness that can lead to security issues.

Mind your performance

The number of queries that your plugin makes can affect its performance. We don’t care how cool your plugin is — if it uses 10 MySQL queries on every page, it’s not going in. You should work to minimize these queries as much as possible. Other performance issues like the efficiency of your PHP code should be taken into consideration as well.

Use existing WordPress data structures whenever possible

Don’t create your own tables unless you’re absolutely certain there is no way to accomplish your functionality within the WordPress data system.

I’m going to go into more detail on these topics at a later date. Maybe even with screencasts, which seem to be a great way of demonstrating these sorts of things.

WordPress 2.5.1: Shortcodes updates

WordPress 2.5.1 is out, with a ton of little bug fixes and one important security fix. Go upgrade your 2.5 blogs now.

One area that has changed is shortcodes, those little square bracket shortcuts like [gallery]. In WP 2.5, those were processed before paragraphs were auto-created and quotes were curled. This lead to funky (and invalid) XHTML formatting for block-level shortcodes like the [gallery] one. In 2.5.1, shortcodes are parsed “at 11” — that is, after paragraphs are wrapped and quotes are curled. Additionally, a shortcode with a buffer line between surrounding content will not be paragraph wrapped.



That shortcode’s output would be untouched by WordPress — whatever the shortcode outputs is going to the browser. Note that if you’re a plugin developer and you want the output of your shortcode to be p-wrapped or have its quotes curled, you’ll have to call those functions yourself. At some point in the future we may add more options for shortcode calling, but for now, you’re on your own for formatting.

Be sure to check out the excellent documentation for this feature!

WordPress Tip: Reorder your Title Tag

WordPress, by default, creates <title> tags that look like this: <title>Yoursite » Your Post Title</title>.  Many people want to use <title>Your Post Title » Yoursite</title> instead, to give more importance to the mutable part of the <title>.  There are plugins to do this, but I’d like to show you how a simple change in your theme can accomplish this task. Caveat: this only works in WordPress 2.5 and above.

  1. Open your header.php theme file (if you don’t have one, open index.php or whatever one has your <title> tag)
  2. Look for:
    <title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title>
    (or something similar) 
  3. Replace it with:
    <title><?php wp_title('&raquo;', true, 'right'); ?> <?php bloginfo('name'); ?></title>

The first wp_title() argument is the separator character.  I like &raquo; (which looks like: »).  The second argument is whether to echo (print to the browser) the title, or to return it.  We want to print it, so we put true.  The final argument is where the separator should go… on the left or on the right. We want right, so we put "right". Simple enough!

Update: I got confirmation from Matt Cutts at Google that this is better for SEO.