I have a caching plugin (WP Rocket) so I am aware of the issues with wp-cron and scheduled posts. So, I disabled wp-cron and then set up a system cron. Now, I noticed that when a post is scheduled it's not set to HH:MM:00 but has some number greater than 0 seconds. So, I set the system cron to run wp-cron at every 5 minutes and 35 minutes past the hour. And still I get missed schedule on posts. I know it runs as I have the output logged which shows a 200 return code plus I see my cache files with timestamps at 5 minutes and 35 minutes past the hour.
define('DISABLE_WP_CRON', true);
Cron entry (I x'd out my user name. I also have one for 35 minutes with output to wget35.log):
5 * * * * wget -o /home/xxxxx/logs/wget5.log https://www.jennystampsup.com/wp-cron.php?doing_wp_cron 2>/home/xxxxx/logs/wget5.err
Update
Using WP-Control I see that the check_and_publish_future_post
event for the post remains as an event after wget
runs. I can run it manually from WP-Control and the post_status
went to publish. If I run wget
twice it works. The first wget
took one second. The second took 17 seconds, but after it ran the check_and_publish_future_post
fired. I will create a script that runs wget
several times with some sleep statements and that should do it.
Update 6/27
So, posts on my site are scheduled for 7:00:XX. So, I wrote a script that hits wp-cron.php
10 times, sleeping two seconds in between each hit, and had it kick off in my system cron at 7:01. And still publish_future_post
did not fire. I looked at the WP Cron schedule prior to my script firing and there were 8 other cron events waiting to fire. They all fired. So, I went to Cloud9 and hit wp-cron.php
from there. This caused the publish_future_post
to fire. The only variables there are it is a different ip and time zone. Those should make no difference as far as I know. This is very puzzling.
*/5
) or plugins which promise to solve this, like this one?