WordPress is a popular CMS and blogging platform. Reich Web Consulting specializes in WordPress websites and custom theme and plug-in development.


A WordPress Update is Available

Why You Should Wait Before Updating WordPress

A WordPress Update is Available

The Dashboard lets you know when a WordPress update is available.

Have you ever heard people who upgrade to the latest version of Windows complain about the experience?

When you upgrade to a new operating system there’s a good chance that the update will contain flaws that need to be addressed by hotfixes and service packs, your hardware manufacturer may not have compatible drivers yet, and certain applications just won’t work.

WordPress isn’t so different. When you update WordPress you can run into incompatibilities in plug-ins, themes, and even your own customizations. WordPress updates are usually trouble-free and will only break very complex or poorly maintained sites. But problems can and do occur, so I recommend holding off a few weeks before updating WordPress sites.

Unless an update contains a fix for a known security vulnerability, let early adopters work out the kinks first before updating your blog.

Don’t rush into an update unless you really need it. You can find out just how critical an update is by checking the WordPress Development Blog widget on your WordPress Dashboard or by clicking the Current WordPress Version link at the WordPress Codex . WordPress has a lively community and you can usually expect plugin compatibility to be tested within a few weeks or months of a WordPress update being released.


What To Do When Wpautop Attacks Your Markup

Professional WordPress Plugin DevelopmentThere are fewer things more annoying about the WordPress platform than watching your carefully-crafted markup go straight to Hell.  If you’ve used WordPress for more than 10 minutes you probably know what I’m talking about.

The primary culprit is a filter called wpautop that automatically applies to post and page content. The wpautop filter converts double line breaks to sets of opening and closing paragraph tags.  It works fine if your posts are text only, contain no images, no short codes, and only the most basic inline markup.  Throw a few block-level elements into a post or a shortcode or two, however, and watch your markup devolve into a tangled mess of improperly-nested tags.

How To Tell If Wpautop Is Causing Problems

You can usually tell if wpautop is causing HTML validation to fail if the W3C Validator is giving you the errors:

document type does not allow element "xxx" here

followed by

end tag for "xxx" omitted, but OMITTAG NO was specified

Seeing this combination of errors, particularly when the tag in question is a <p> tag, is a pretty good indication that wpautop is to blame.


The following are a few common solutions for living with, or without, wpautop in WordPress.

Turn it Off

If you are comfortable with HTML markup you may be better-served by just disabling wpautop completely and specifying all of your own HTML markup when writing blog posts. You can disable wpautop either by installing a plug-in that does it for you (this one for example), or by adding the following lines to your theme’s functions.php file:

remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );

Use wpauto-control

I like to use the wpautop-control plugin, which allows you to set wpautop to enabled or disabled by default, then switch it on or off on a post-by-post (or page-by-page) basis. This allows me to develop complex pages with wpautop disabled, but leave it enabled for simpler blog content created later by my clients.

Moving Posts Between Categories in WordPress

At some point or another, you may want to adjust the structure of categories in your WordPress blog.  I just ran into such a situation when a client who was previously managing two blogs (one for “News” and one for industry “Ramblings”) wanted to merge their two blogs into a single blog.  Using WordPress and a little bit of SQL, I’m going to teach you how to move posts in bulk to a new category. This tutorial assumes that you are using the default “wp_” table prefix, so make adjustments as neccessary; and as always, create a backup of your database before trying any of the steps below.

Step 1: Create the New Category

This step is easy.  Simply create the new category as you normally would from within WordPress.  After the category has been created, issue the following SQL against your WordPress database to determine the ID of the new category:

SELECT * FROM WP_Terms WHERE category_name = "New Category";

For me, this command told me that the id of my new category was 46, so I’ll remember that and continue to the next step.

Step 2: Find the ID of the Old Category

Now we need to do the same thing, but for the old category.  In my case I am moving all Uncategorized posts to the category I just created, so I need to find the unique ID of the “Uncategorized” category:


This command tells me that “Uncategorized” has a unique id of “1”, so I’ll remember this value and continue.

Step 3: Update the Post/Category Relationship

In this step we’re finally modifying our database, so make sure you have a backup of your WordPress database before you continue.  We’re now going to update the relationship between the posts and the category.  The WP_TERM_RELATIONSHIPS table contains a list of post-to-category relationships.  The OBJECT_ID field specifies the unique id of the posts, the TERM_TAXONOMY_ID field specifies the unique ID of the category. So what we need to do is update any record with TERM_TAXONOMY_ID equal to the value from Step 2 to the ID of the table we created in Step 1:


And voila! Your posts will now be treated as members of the new category.

Resetting Your WordPress Password

Bloggers: have you ever forgotten the password for one of your WordPress blogs?  Or attempted to take over or maintain a blog setup by someone else who doesn’t know the admin password?  This is your lucky day!

Assuming you have access to the database containing the WordPress blog’s data, resetting the password is easy. Assuming that the blog is using the default “wp_” table prefix, the user account is named “admin,” and the new password is being reset to “password”:

UPDATE wp_users SET user_pass = MD5("password") WHERE user_login = "admin";

For more information about resetting a lost WordPress password, see the official page on the subject at the WordPress Codex.

Creating a Child Theme in WordPress

A couple of days ago I updated Lightword, the theme that I’ve been using on this blog for quite a while now. Unfortunately when I did the update I lost all of my customizations, including my logo and Adsense code.  So I went looking for a solution.

Little did I know, WordPress has supported a feature called “child themes” for some time now.  The idea is that you create a new theme, which is as simple as creating a new directory with a single CSS file called style.css, and add a comment to the new CSS file specifying the name of the parent theme.  You can read all about how to create a child theme here.