WordPress Missed Schedule Posts
I just discovered that scheduled posts on my Riddles and Brain Teasers site hadn’t been working as far back as last year. Whoops! On the bright side, today saw a flurry of additions.
It’s a little odd that WordPress can tell you it missed publishing a scheduled post, but still doesn’t publish it. It’s like a butler coming upstairs to tell you he forgot to bring you something instead of just bringing it.
I spent quite a bit of time digging in to why it wasn’t working and eventually discovered the culprit was W3 Total Cache’s database cache. Disabling it solved the problem.
But I had already started using a real cron job on the server and I chose to leave it. It means WordPress doesn’t have to check for scheduled tasks on every request, speeding up page loads a little.
To recap, if your scheduled posts aren’t publishing and you’re using W3 Total Cache, you can just disable the database cache. Or, if you want to use a real cron job (which I already do for numerous other tasks), follow the steps below.
1. Add this define to your wp-config.php file.
Anywhere will work. I added it after the DB_COLLATE define, around line 36.
define('DISABLE_WP_CRON', 'true');
2. Create a cron job
If you’re not familiar with cron, it’s a task scheduler on Linux / Unix systems. Most web hosts will have it somewhere in their control panel. If not and you have shell access, run cron directly with crontab -e and add these two lines.
# Run every hour on the hour
0 * * * * wget --quiet --output-document=/dev/null "https://example.com/wp-cron.php?doing_wp_cron"
This will load WordPress’ wp-cron.php file every hour.
And now you can can get back to scheduling your posts.
Great post.
A easy way, we can use this useful module to create wp cron: https://wordpress.org/plugins/easycron/.
Thanks :)