JohnC--
JohnC--

Reputation: 306

Understanding WordPress Cron

What will be the best way to activate WordPress cron if your site has no hits or visits?

Just starting out my new DAILY BIBLE QUOTE blog and I have no hits yet. I have scheduled a post to published “once every day at 6:00 AM”. Since I have no hits I’m afraid the scheduled post will not get published, so i add cronjob on my shared cpanel hosting using the code below:

0 6 * * * wget -O /dev/null --timeout=120 http://example.com/wp-cron.php?doing_wp_cron=true

So my question is,

  1. Will the scheduled post gets published using the command above or querying only the site http://example.com/ on the cron command is enough to do the job?
  2. Do i need to scheduled the post at 6:05AM and add crontab to run at 6:00AM?
  3. Do not run cronjob on the site hosting since the IP is going to be same, so better use a cron service like EasyCron using the FREE plan https://www.easycron.com/user/plan since the IP is going to be different so that my site will think of it as a new visit, hence activating wp-cron.

Upvotes: 0

Views: 483

Answers (1)

MillerMedia
MillerMedia

Reputation: 3671

To address your questions:

  1. Yes, you would simply need to load the homepage of your site (though you could load any page of the site) to trigger the WP Cron event. When you load the WordPress stack, on any page, it will load the entire WordPress stack and part of that loading is checking the database to see if any cron events are ready to run. The cron information is saved in the database with information on the time the next instance of that cron runs and the function/hook to run at that time, if anything matches it will fire off the event.

    For more information on WordPress cron, you can review their documentation here: https://developer.wordpress.org/plugins/cron/

  2. Why not schedule the post at 5:59AM and then run the cron at 6AM? That would ensure that it gets published right on the minute.

Upvotes: 1

Related Questions