How to Troubleshoot WordPress Scheduled Post Not Publishing
Symptoms
The easiest way to determine if the problem is caching-related is by comparing the actual website’s front page (or any page where the new post or page should be accessible) against the dashboard. WordPress dashboard will say the post is already published, but the post remains unavailable, caching is likely the issue.
Caching plugin I use, LiteSpeed, does purge all cache upon dashboard login, and I expect other plugins would have similar features or behaviors enabled. If the post becomes available once someone with administrator privilege logs in to the WordPress dashboard, that is also a likely symptom.
Solutions
This would largely dependent on the said plugin’s ability, and the way it handles automatic purging. On LiteSpeed, settings page has Purge > Purge All Hooks section, where the user can add the WordPress hooks to purge the cache when a scheduled post is published:
The hook in question is: future_to_publish
- draft post publishing:
draft_to_publish
- any posts publishing:
publish_post
As a bonus, you could add another hook for post being updated as well. I use Ulysses to write and manage WordPress posts, and that can also have similar issues.
The hook for updated post is: inherit_post
Afterthoughts
In case anyone is curious what a hook is, and how adding a hook fixes this problem, I will try my best to cover some bases —and for future-proof purposes, what I am trying to do with this. In WordPress, most functions can attach itself to a hook; it’s the way to manage ‘when’ (condition) the function should trigger. The hooks I listed, one for the scheduled post published, the other for post updated, triggers when that exact behavior happens. The idea here is the caching plugin will purge all old cache once that behavior occurs; the root of the problem is that we are seeing old cached contents.
That being said, I’m not entirely sure why the caching plugin does not already have that option enabled. The hooks I specified would be common occurrence for WordPress-based websites that updates frequently. I’ll update the post if I find out more about it.
note Nov 8, 2024: I found the most common practice to fix wp-cron problem is to have it replaced with Linux cron. Please do check out the related post.
Comments