Raquel M Smith

How to Add Custom Cron Job in Dreamhost for WordPress

There are two reasons you may want to add custom cron jobs for your WordPress website:

  1. Your site is low-traffic and you want cron jobs to run regardless of whether or not someone visits the site
  2. Your site is high-traffic and checking if a cron job needs to be run every time someone visits the site is a burden on your server

Adding a custom cron job for WordPress in your Dreamhost account is easy. First, you disable the default WP Cron in your config.php file. Next, you add the cron job to your Dreamhost account. Let’s get started!

How to Disable the Default WP Cron

Open up your site’s config.php file. This is in the root of your WordPress installation. You’ll need to have access to your site’s files directly (eg. with FTP) as this isn’t something that can be edited from within the WordPress dashboard.

Scroll down to the bottom. Right before you see the line that says /* That's all, stop editing! Happy blogging. */, add the following code:

/* Turn off default WP Cron */
define('DISABLE_WP_CRON', true);

Save the file.

How to Add a Manual Cron Job in Dreamhost

Log in to your Dreamhost dashboard. Navigate to Goodies -> Cron Jobs in the left-hand navigation.

Select “Add a New Cron Job.”

Select the user associated with your website and give the cron job a title – “WordPress Cron Jobs” usually does the trick. Enter an email address you want the cron output sent to. This isn’t necessary, but is nice to have until you know everything is running properly.

In the “Command to Run” box, enter the following, using your domain name instead of example.com:

curl https://www.example.com/wp-cron.php

Select an interval for when to run. Hourly is common, daily works also. Keep in mind that until you turn the email off, you’ll get an email every time the cron job is run.

Click the blue “Add” button at the bottom to save the new cron job. And you’re done!

Leave a Reply

Your email address will not be published. Required fields are marked *

1 Comments on "How to Add Custom Cron Job in Dreamhost for WordPress"

  1. Dave

    November 22, 2019

    Nicely done. Love the information. Very helpful. Thank you. Cheers. Dave.

  • About
  • Projects
  • Bookshelf
  • Blog
  • Github@raquelmsmith
  • LinkedIn@raquelmsmith
  • Emailhello@raquelmsmith.com