Automating WordPress Database Backups with WP-Cron

A few weeks ago, I wrote an article explaining how to back up a WordPress database. This is something that all WordPress users should be doing regularly.
But if you’re like me, you just don’t think about manual backups. I went through a spell where I backed up one of my databases every time I remembered to do so. That turned out to be once every month or two. With the sheer quantity of blog entries that appear on my blog-based Web sites, that’s a lot of content that would be lost in the event of a system crash.
Enter WP-Cron. This WordPress plugin by Scott Merrill is basically a one-trick pony: it’ll automate the completion of a task, performing it once a day. I use it with Scott Merrill’s WordPress Database Backup, which is part of a WordPress 2.0.x installation.
Keep in mind that WP-Cron (and WordPress Database Backup, for that matter) only work on a server installation of WordPress. If you’re using WordPress.com, the folks who run that server are backing up your database for you.
Setting up WP-Cron is simple.
- Download, install, and activate the WP-Cron plugin. (If you need help or more information about plugins, consult our WordPress book, which covers the plugin installation process extensively.)
- Log in to WordPress and open your dashboard.
- Click the Manage button in the first row of buttons. The Manage Posts administration panel appears.
- Click the Backup button in the second row of buttons. The Backup administration panel appears.
- Scroll down to the Scheduled Backups area.

- Beside
Schedule, selectDaily. - Turn on the check boxes for each table you want to include in the backup. These are in addition to the blog-related database tables, which are backed up automatically. The tables in the list will vary depending on plugins. I usually turn them all on, although that can make the backup files large.
- Enter an e-mail address in the
Email backup tobox. This should be an e-mail address that can receive large files. (For example, my marialanger.com site backup file is about 1.8 MB.) - Click
Submit. After a moment, the screen should refresh with a message at the top saying that your options have been saved.
From that point on, around midnight your WordPress database will be backed up and e-mailed to you. You’ll get these backup e-mails daily, so you want to be sure to check your e-mail at least a few times a week. I usually keep the last two backup e-mails for each of my blogs and discard the others. Be sure your e-mail is set up to remove messages from the server when they are deleted or you may quickly fill up your allotted e-mail space on your ISP’s server.
My only gripe about WP-Cron is that you can’t set the backup period. Although daily is a good option for MariaLanger.com, which can get up to 10 new posts a day, it isn’t necessary for my wickenburg-az.com blog, which gets, on average 2-4 new posts a week. I’d like to be able to set a custom backup period for each blog to minimize server workload (although it isn’t my server anymore) and delivered e-mail.
Otherwise, WP-Cron is a must-have plugin. I highly recommend it for anyone who is serious about keeping their blog content safe.
Technorati Tags: backup, howto, WordPress
Default Theme Changed

Reader Mike O’Hara wrote to us because he was having problems following the instructions on page 131 to change the default theme’s header. When we checked his comments, we realized that the Default theme has been changed since we wrote the book. We used version 2.0.1, which was the current version at the time. WordPress 2.0.4 is now available (as I write this). Somewhere between the two versions, the Default theme was changed.
The instructions on page 131 in our book will not work with the Default theme for WordPress 2.0.4. We’re working on coming up with new instructions. But until they’re ready, you can download the 2.0.1 Default theme from a link in the new Downloadable Files section of the sidebar of this site.
Many thanks to Mike for reporting this problem. We hope to get a resolution to readers soon.
Technorati Tags: default, correction, theme, WordPress
Moving to GoDaddy, Part 2: Making the Move

(For those of you just tuning in, this is the second part of a two-part series that explains how to move an existing WordPress blog to a GoDaddy.com hosting account.)
A WordPress blog consists of multiple parts:
- A mySQL database that contains the content of the blog entries, comments, and other important data.
- Content files including themes and their template files, plugins, images, etc.
This is important because in order to rebuild your blog on another server, you must have all the parts.
WordPress.com vs. WordPress Server Installation
If you have a WordPress.com blog, your access to blog files is somewhat restricted. It’s not that you can’t access them — it’s just that account access is simplified, thus making it more difficult to extract data.
For example, a WordPress server installation can be backed up, thus resulting in a mySQL-compatible backup file that can be imported into a new mySQL database. A WordPress.com blog can only be exported in XML format, requiring an appropriate importer on the new WordPress installation to import the files.
A WordPress server installation commonly stores all non-database content in the wp-content folder, including themes, plugins, and uploads. You can use FTP client software to access and download this content. A WordPress.com blog stores all non-database content in the bowels of the WordPress.com server. It’s still accessible, but you can’t just use FTP to download it all into one place. In addition, the themes are part of the WordPress.com feature set, so they can’t be extracted from that server. Instead, you’ll have to start from scratch by installing the theme you want in your new blog installation and activating it for your new blog.
As a result of these differences — and the fact that most folks who might be interested in moving their blog to GoDaddy.com are already using a WordPress server installation, this article will cover a server installation move. If you have a WordPress.com blog and want to move it to GoDaddy.com, use the Comments link for this post to let me know. If enough people are interested, I’ll write up the instructions for the export and import.
Backing up the Database
Start by backing up your WordPress database.
If you already do a complete backup regularly and haven’t made a change to your blog since the last backup, you’re already done with this step. Move on.
But if you’re living life in the fast lane and don’t back up regularly (or at all), follow the instructions my article titled “Backing Up a WordPress Blog Database”
Backing Up the Content Files
Next, back up your blog installation. That’s all the files and folders in the root directory for your WordPress blog.
How you do this depends on how you can access the server.
In my case, the server is accessible by a local network, so I just used the network to open the copy a blog’s folder on the network drive to my local hard drive.
If your blog’s files are on a remote server, you’ll have to use FTP software like Fetch or CuteFTP to access the server and “get” the files. We explain how to use FTP software in Appendix B of our WordPress book.
Creating a mySQL Database at GoDaddy.com
Next, you’ll need to create a database on GoDaddy.com to hold your blog entries and other database content.
- Log Into your GoDaddy.com account.
Choose My Hosting Account from the Hosting & Servers menu on the green navigation bar.
In the Hosting Account list, click the Open link beside the account you want to use for your blog.- In the Hosting Manager window, click the MySQL icon (or link) under Databases.
- Click the Create New Database button in the MySQL window.
In the MySQL Database Connection Information boxes, enter a user name and a password (twice). The user name will also be the name of your database. Click Continue.- The user name will appear in the next window. Click Create Database to confirm it.
- The new database appears in the list of databases with the words Pending Setup beside it. Setup usually takes 5 to 20 minutes.
Get the Server Host Name for the Database
Unlike most WordPress server installations, the host name for a Godaddy.com-hosted WordPress blog is not localhost. So what is it?
The host name can be different for every database. To find out what it is for your database, follow these steps:
- Log Into your GoDaddy.com account.
Choose My Hosting Account from the Hosting & Servers menu on the green navigation bar.
In the Hosting Account list, click the Open link beside the account you want to use for your blog.- In the Hosting Manager window, click the MySQL icon (or link) under Databases.
- Click the link for the user name of the database you want to use.
Look at the Host Name field in the My SQL Database Information area of the Edit a MySQL Database window. Write it down — you’ll need it later.
Import the Data into the Database
Now it’s time to import the data from the backup file into the new database you just created. It isn’t hard — once you know where the right buttons are hiding.
- Log Into your GoDaddy.com account.
Choose My Hosting Account from the Hosting & Servers menu on the green navigation bar.
In the Hosting Account list, click the Open link beside the account you want to use for your blog.- In the Hosting Manager window, click the MySQL icon (or link) under Databases.
- Click the Open Manager button for the database you want to import into.
- Enter the database’s user name and password in the login window and click Log In.
Click the Query Window button on the left side of the phpMyAdmin window that appears.
Click the Import Files tab of the query window that appears. Then click the Browse button and use the dialog that appears to locate, select, and open the backup file you created earlier. Its path should appear in the Location box, as shown here. Click Go.
phpMyAdmin imports the data. It displays the data tables in the main window, hiding the Import Files query window from view. Close the phpMyAdmin and query windows.
Copying Your Other Data to Your New Blog Site
You’ll need to use FTP software to copy your WordPress blog folder to the proper directory on your GoDaddy hosted account. Where you copy it depends on how you configured GoDaddy, as discussed in the previous article of this series:
- If you’re just using the domain name the GoDaddy.com account is set up under (either your free hosting account or a paid for account), put the contents of your WordPress folder (not the folder itself) into the root directory of your hosting account.
- If you’re using a subdomain or other domain name for your blog, put the contents of your WordPress folder (not the folder itself) into the folder you specified when setting up the subdomain or other domain. You may have to use your FTP software to create the necessary folder first.
We explain how to use FTP software in Appendix B of our WordPress book, so I won’t repeat that information here.
Modifying the config.php File
The config.php file, which resides in the root directory of a WordPress installation, must include the correct database name, password, and host. Even if the database name and password are the same as they were on your old installation, the Host probably won’t be.
- Use your favorite text editor (not word processor!) to open the config.php file for your blog — preferably the one you’ve already copied to the server. (You can open a local copy, but you must use FTP to put it on the server when you’re done making and saving changes.)
Modify the values in single quotes in each of the define statements in the file. (That’s lines 3 - 6.) This information must match your database setup exactly. The database name and user name will be the same.- Save the file to the server, overwriting any existing file.
Are You Done?
At this point, you’ve done most, if not all, of the work required to make the move. There are just a few things to keep in mind:
- Test your site by entering its URL in a browser window. If it comes up without error messages, take the rest of the day off — you’re done.
- If you’re using a DNS server other than GoDaddy’s or you have modified GoDaddy’s DNS server, you’ll have to change the A record to point to the IP address of your site’s Web server. You do this with GoDaddy’s Total DNS Control feature. You can find the server’s IP address by clicking the account name in the Hosting Account list. Your site will not be reachable until you do this — in fact, you might not even be able to access it via FTP to upload the files until this is done.
- If links to pages or images or other files in your blog entries had fully qualified URLs (for example,
http://www.marialanger.com/wp-content/images/picture.jpg) rather than relative URLs (such as/wp-content/images/picture.jpgfor content within the blog and you now have a new domain name, you’ll have to manually change all the URLs so they point to the correct domain name. Not fun, I know. You might be able to do a global change using phpMyAdmin, but please don’t ask me how. I don’t know. - If you want to start with a fresh installation of WordPress, you can install it into the proper directory on your GoDaddy hosting account. (We explain how to install WordPress in our WordPress book.) Then just copy the
wp-contentfolder from your existing site to the new site. - If your old site has a different domain name, it will continue to operate normally until you delete it. I recommending creating an entry in
.htaccessto point to the new location. If both versions of your site (original and new) have the same domain name, wait a day or two to delete the old one to give the domain name system a chance to propagate the new IP address of your site. Any new comments on the original site will not be carried forward to the new site.
Technorati Tags: GoDaddy.com, hosting, howto, WordPress
WordPress 2 book - the PDF

A potential reader asked me if our book is available as a PDF. It turns out it is: WordPress 2: Visual QuickStart Guide PDF.
This product is offered as an Adobe Reader™ PDF file and is available for download after purchase. (Adobe Acrobat PDF. Requires Adobe Reader 7.0.)
So, save a tree today, and avoid that long shipping wait.
Bad Behavior WordPress plugin updated

As I look at my TiKouka blog this morning I note the stats at the very bottom of the page:
There are currently 1,779 posts and 255 comments, contained within 26 categories.
This blog is protected by Spam Karma 2: 102385 Spams eaten and counting…
Bad Behavior has blocked 4470 access attempts in the last 7 days.
My blog gets hammered by the bad guys attempting to leave comment spam. While Spam Karma handles them well, the Bad Behavior plugin helps out enormously, keeping much of it away so Spam Karma doesn’t have to work so hard. It’s now been updated to version 2.0.6, with a new method of blocking spam.
As always, be sure to check the plugin’s documentation for information if you have any problems with it.
I found, a few months ago, one genuine visitor who was blocked by the Bad Behavior plugin. She was visiting from behind a firewall at a New Zealand government department. Disabling Bad Behavior allowed her to visit, but also allowed an enormous flood of spam through too. After a few days I enabled the plugin again.
Update: I’ve deleted my previous post on this topic as I have no personal experience about how this plugin does or does not work on services apart from my own.
Moving to GoDaddy, Part 1: Setting Up Your GoDaddy Account

As reported elsewhere, I recently moved my WordPress blogs from my own server to GoDaddy.com. I was looking primarily for reliability — my G4 was simply dropping the ball (or the connection) too often to rely on. The solution, move all my sites, shut down the server. And GoDaddy had a hosting plan that worked perfectly for my needs without costing an arm and a leg.
Now if you have beefs about GoDaddy, feel free to use the Comments link to voice them. All I ask is that you be factual and keep your comments limited to your own personal experiences. I know that some folks absolutely hate GoDaddy.com, but since I’ve never had any problem with them, I can’t complain. But I don’t want to see this site turned into a GoDaddy bashing forum.
Also, these instructions apply to GoDaddy.com. I don’t think they’ll work with any other ISP. This is the ISP I use, so this is the ISP I know and can illustrate with screenshots. If you have instructions for doing this with another ISP, by all means, use the Comments link to share a URL.
And although these instructions and screenshots were created on a Mac, they work on Windows, too.
This is a two-part article — it’s just too darn long to write and release this information in one piece. I highly recommend that you read both article in this series before you attempt to follow them. It would not be a good thing if you completed the instructions in the first article and then didn’t have the next article to finish the job.
And one more thing…these instructions are for intermediate to advanced WordPress users. You might find it helpful to fully understand the server-installation information in our book, WordPress 2: Visual QuickStart Guide before trying an advanced task such as a WordPress blog move.
Ready? Here are the first bunch of steps.
Register a Domain Name
The first step to setting this up is to register a domain name. I highly recommend doing it at GoDaddy.com. It’s cheap and easy. Best of all, you won’t have to deal with DNS because with everything registered at GoDaddy.com, their servers take care of everything for you.
I won’t explain how to buy a domain name. Just go to GoDaddy.com, use the search box on the Home page (see screenshot below) to search for the domain name you want, and follow the instructions on the site to buy it.

Keep in mind that you’ll have to “run the gauntlet” — that’s my phrase for the offers GoDaddy.com will throw at you when you buy anything. My advice is not to buy any of it. You’ll get e-mail, FTP, and all kinds of goodies with your hosting account. And do you really need example.net, example.info, or example.tv? One domain name is enough. Don’t let those offers and promises of savings suck you in.
If You Already Have a Domain Name Registered Elsewhere…
I recommend moving it to GoDaddy.com. It’ll really simplify the DNS thing.
Of course, if you’re an experienced system administrator and know DNS like you know your best friend and have access to a DNS server that you can modify and like your domain name registrar, there’s no reason to move.
And please don’t expect me to explain DNS. I only know enough to make me dangerous.
Open a GoDaddy.com Hosting Account
Go to GoDaddy.com’s Hosting Plans page (see screenshot below) to learn what’s available. For 99.9% of bloggers, an Economy Plan account will be just fine. If you’re also podcasting large audio or video files, you might want to spring for a Deluxe Plan account to give you extra bandwidth. My recommendation: start small, monitor disk space and bandwidth usage, and upgrade if necessary. You don’t lose anything when you upgrade, so it won’t require any kind of reconfiguration.

I use the Deluxe Plan because I host multiple domain names with one account. If you like to have a custom domain name for your blog (like myblog.example.com) you can use the Economy Hosting plan’s subdomain feature to map right to your blog folder.
But now I’m getting ahead of myself.
Again, I won’t explain how to open a hosting account. Just follow the instructions on GoDaddy.com.
VERY IMPORTANT: You must set up a Linux hosting account, not a Windows hosting account. This makes it possible to use PHP which WordPress needs to run.
You may get an offer for a discount on hosting when you register a domain name. That’s the offer you should accept, although it’ll only save you a few bucks.
You may get a free hosting account when you register a domain name. I have somehow accumulated 28 credits for free hosting accounts. I used one once and it put advertising at the top of every page on my site. If you’re on a tight budget and don’t care about the ads, try this. But don’t ask me to explain how to get one of these free hosting credits; they just appeared in my GoDaddy account. (And no, they can’t be transferred to friendly readers of my blog.)
Link Your Hosting Account to your Domain Name
If your domain name is already linked to an existing blog on your own server, following this step will disable your blog until setup is complete. So you might want to read through all of these instructions (including the remaining part of this series) and get ready to complete them quickly before continuing.
How you do this depends on how you’ve set up your hosting account with GoDaddy.com.
If you’re using a free hosting credit…
- Log Into your GoDaddy.com account.
Choose My Hosting Account from the Hosting & Servers menu on the green navigation bar.
Click the Use Credit link in the yellow box near the top of the page.
In the Setup Free Hosting box that appears on the right side of the page, use the drop-down list to choose the domain name you want to link to the hosting account. Select the Free Linux Hosting radio button, and click Continue.
New Account should appear in the Hosting Account list. Click the Setup Account link beside it.- If an End Use License Agreement appears, read it (or at least pretend to) and click Accept.
Enter a User ID and Password (twice) in the Hosting Server Login Information area. This information is different from your GoDaddy.com Account login information. It’s the info you’ll need to access your site via FTP, so be sure to make a note of it for future use. Then click Continue.- Click Submit in the confirmation window that appears.
- Close the Hosting Manager window.
If you have a economy hosting account and don’t plan on using subdomains…
- Log Into your GoDaddy.com account.
Choose My Hosting Account from the Hosting & Servers menu on the green navigation bar.
New Account should appear in the Hosting Account list. Click the Setup Account link beside it.- If an End Use License Agreement appears, read it (or at least pretend to) and click Accept.
In the Hosting Server Information area, choose or enter a domain name to link to the hosting account. (If you enter a domain that is not registered at GoDaddy.com, you’ll have to modify that domain’s DNS information to point to your GoDaddy server; I tell you more about that in Part 2 of this series.) Then enter a User ID and Password (twice) in the Hosting Server Login Information area. This information is different from your GoDaddy.com Account login information. It’s the info you’ll need to access your site via FTP, so be sure to make a note of it for future use. Then click Continue.- Click Submit in the confirmation window that appears.
- Close the Hosting Manager window.
If you have an Economy Hosting account (free or paid) and want to use subdomains…
- Follow the instructions in the appropriate section above.
- Wait until you get an e-mail message from GoDaddy.com telling you that your hosting account is ready to use. This can take up to 24 hours, but is usually less than an hour.
- Log Into your GoDaddy.com account.
Choose My Hosting Account from the Hosting & Servers menu on the green navigation bar.
In the Hosting Account list, click the Open link beside the account you want to use for your blog.- In the Hosting Manager window, click the Domain Management icon (or link) under Settings.
- In the Sub Domain area of the Domain Management page, click the Add Sub Domain link.

Enter a name for the subdomain in the Sub Domain box. This is the part of the URL before your domain name. For example, if your subdomain URL should be myblog.example.com, enter myblog in the Sub Domain box. Then choose or enter a relative path to the folder in which the blog’s files will be stored. For example, if your hosting account had a folder named wordpress and that’s where you planned to put your blog files, you’d choose <enter directory path>, click in the Path box to select the text there, and type in /wordpress. Then click Save.- The subdomain you added appears in the Sub Domain list with a status of Pending Setup. Setup is usually complete within an hour.

Keep in mind that the above instructions assume you have Hosting 2.0 configuration installed. If you’re set up with Hosting 1.0, click the link in the Hosting Manager window to upgrade. It’s free and does not require any reconfiguration. It will, however take a bit of time to convert — possibly an hour or so. You can do this with Hosting 1.0, but I’m not prepared to write detailed instructions for it, so you’ll have to go it alone.
If you have a Deluxe Hosting account and want to use a different domain name…
- Make sure the domain name you want to use is registered on GoDaddy.com as discussed earlier in this article.
- Follow the instruction in the section above titled “If you have a economy hosting account and don’t plan on using subdomains…” to set up the hosting account with your primary domain name. (You may have already done this if you use that domain for a Web site or something else.)
- Log Into your GoDaddy.com account.
Choose My Hosting Account from the Hosting & Servers menu on the green navigation bar.
In the Hosting Account list, click the Open link beside the account you want to use for hosting your blog.- In the Hosting Manager window, click the Domain Management icon (or link) under Settings.
In the Assign Domain to Hosting Site area of the Domain Management page, use the drop-down list to choose the domain name you want to host on the account. Then, in the Domain Hosting Path drop-down list, choose or enter a relative path to the folder in which the blog’s files will be stored. For example, if your hosting account had a folder named wordpress and that’s where you planned to put your blog files, you’d choose <enter directory path>, click in the Domain Hosting Path box to select the text there, and type in /wordpress. Then click Add Domain.- The domain you added appears in the list with a status of Pending Setup. Setup is usually complete within an hour.
Keep in mind that the above instructions assume you have Hosting 2.0 configuration installed. If you’re set up with Hosting 1.0, click the link in the Hosting Manager window to upgrade. It’s free and does not require any reconfiguration. It will, however take a bit of time to convert — possibly an hour or so. You can do this with Hosting 1.0, but I’m not prepared to write detailed instructions for it, so you’ll have to go it alone.
Problems? Questions?
Use GoDaddy.com’s online or telephone support if you have a question specific to your setup with them. I recommend using support in this order: (1) Web-based help, (2) telephone support, (3) e-mail support. E-mail support sucks (I can’t be any clearer than that), telephone support is good but is not toll-free (wait times are usually less than 5 minutes), and online support is very good but incomplete, so your question may not be addressed.
In the next and final installment of this series, I’ll explain how to make the move.
Technorati Tags: GoDaddy.com, howto, WordPress