Scheduling in PublishPress Future: Cron Jobs

The scheduling in PublishPress Future is handled by cron jobs.

This plugin does require that WP Cron is setup and functional on your webhost. Some hosts do not support this, so please check and confirm if you run into issues using the plugin.

You can see all the active cron jobs on your site by going to “Future” in your WordPress admin menu and then clicking the “Diagnostics” tab. This table will show all currently scheduled cron events with the connected settings. PublishPress Future creates an event called postExpiratorExpire. You can see this in the image below:

Cron Schedule
Cron Schedule

PublishPress Future will show whether or not a cron job has been successfully set up for your posts to expire. In the image below, “Cron event schedule” means that everything is working correctly.

Cron Scheduled
Cron Scheduled

If the cron job was not created successfully, PublishPress Future will show you the message in the image below: “Cron event not found”.

Cron Not Found
Cron Not Found

Technical details for PublishPress Future cron jobs #

If you want to see expiry details in the database, WordPress stores cron jobs in the _options table. The option_name is cron.

Cron Table
Cron Table

This code below shows a typical cron job entry from PublishPress Future:

{s:19:"postExpiratorExpire";a:1:{s:32:"c8bde69a9f79ca24059e3807f9a3bcf8";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{i:0;i:10;}}}}s:7:"version";i:2;}

Some of the specific details are also held in the _postmeta table. In the image below, the “expireType” is set to “Delete” so this post will be entirely removed from the site when it expires.

  • Post ID: 10
  • Expiry Date: September 3, 2021 8:56 pm. This is set using Unix time which is an integer number that counts date and time in seconds since 1970-01-01. There are convertors available for Unix time including Epoch Converter.
Expiration Date Postmeta
Expiration Date Postmeta

_wp_old_date in the image above is a useful WordPress core feature that is explained in this article.


Alternatives to WP Cron #

In some situations, using the normal WP Cron option in the WordPress core is not an option, or you prefer to use an off-site cron task.

First, define a constant in the site's wp-config.php file

define('DISABLE_WP_CRON', true);

Next, configure a cron job. But this can be done on different ways, depending on the server. The cron job should call this:

wget -q -O - https://mydomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

Professional publishing plugins for WordPress! Get PublishPress