How To Quickly Clean Up Your WordPress Database

I’m putting this post on my site because I’m tired of searching for the commands.

There are plugins that will clean up your WordPress wp_posts table, but if you have access to the database you can do this yourself.

Backup the Database

You should always make a backup copy of your database just in case something goes wrong. This is a “duh” – but it happens – and things can go wrong. You’ll be deleting records from a table so before you do, make a backup.

Run the DELETE Query

Run the following command on your database. If you have a shared host with a cPanel you probably have phpmyadmin which is your user interface to your MySQL database. WordPress usually installs in MySQL as wrdp. You want click on the right database for your WordPress install. Once you are in the right database you can run this query:

DELETE FROM wp_posts WHERE post_type = "revision";

This will delete all the revisions from WordPress. Just out of curiousity you might take a note of how much space the wp_posts table was taking up before and after running this query. That will tell you how much room you recovered.

Optionally, You Can OPTIMIZE

This step is optional. If you are sweating bullets right now after deleting 20,000 revision posts, you can skip this step.

Optimization “releases” the data you deleted from memory thus freeing memory. Its like delete puts data in the trashcan and optimize empties the trash. To optimize the wp_posts table run the following query:


Check to see the size of this table. In the YIW database, the “wp_posts” is only 3,4 Mb in size, as you can see in the photo below. It’s a lot of space saved, don’t you think?

My Numbers

I’ve run this query several times over the years. It’s like cleaning up your computer’s hard drive – the more you use it the more you should clean it up. There were my numbers.

Start 407 rows | 792.1 KB

Deleted 61 rows | 96.1 KB

Finish 346 rows | 695.4 KB

Hope this works for you. I know it works for me and I use it about once a year or so.

Woo Themes

I installed this new theme from Woo Themes, and it appears that they leave off a lot of web elements I took for granted. In the SEO section an admin has to specify a lot of things like title, description, keywords, and what to index. They say they support two of the most commonly used SEO plugins – All-in-One SEO and Headspace 2, but those seem like even more work.

Just in case I change themes again and loose my keywords I listed them here. I used the following keywords for my home page:

Siems, Chris, teamsiems, team siems, web, website, development, developer, Economics, Education, Europe, Nature, Odd, OIT, Personal, Politics, Religion, Social Media, Technology

I used the WordPress default for the title and description. The indexing I left on categories.

UWEB Lightning Talk Notes 09-04-2009

What little I wrote down is here. There is a couple good links.

Robert: who makes user experience design

Stephanie: WordPress content import plugin.

Also see: (UPDATE: WordHTML)

Rob: SVG

Plain text (XML). It can be manipulated by JavaScript (DOM).

Monty: Standard module format

Also see: Yahoo Theather

At the end we had an open discussion where we talked about good resources to learn technologies of the web.

One byproduct of the talk was a resource for handling javascript in IE7 at

For more information about the Lightning Talks or other topics the uWeb group talks about go to