Iwani Khalid
Iwani Khalid

Reputation: 303

Time-sensitive WordPress Post Schedule

TLDR: How to ensure no delay when using WP Post Schedule? When you schedule it at 12pm, it will be published at 12pm on the dot

I am creating a website for a virtual event. Programme itineraries for the event has been created as a CPT using ACF.

On the frontpage, there's a Live Feed section that shows 1 itinerary/post at a time. I use the WP Post Schedule built-in functionality for this purpose. What's happening now is that there is a delay of 20 seconds - 1 minute before these scheduled posts are actually published.

I already have a meta-refresh setup so I hope that helps WP to fire the cronjob without waiting on actual user visit.

I found this but unfortunately it's not working for me, the said #ss isn't present in #timestampdiv

Current Situation

I may have solved the issue above after getting 1 missed schedule earlier and on top of delayed scheduled posts (from 30sec-1min)

  1. Installing Scheduled Post Trigger. I also added is_page() in the plugin's code.
  2. Increasing memory limit in WP Config define('WP_MEMORY_LIMIT', '500M');
  3. Changed meta-refresh time interval from 10 to 20

Spoke too soon

Pfft. 2pm post was delayed by 1min. Well, at least it's not a Missed Schedule. Gonna have to go back the drawing board. Probably trying

  1. Add 3rd party "ping" service
  2. Setup cron to run wp-cron every second. (Server config)

Final Update

Ditched the WP Cron / Scheduled Post and went with displaying post based on start time - end time instead. oh well!

Upvotes: 0

Views: 319

Answers (1)

Phil Veloso
Phil Veloso

Reputation: 1126

To run scheduled tasks, WordPress uses a system called WP Cron. The main issue with WordPress cron and the cron scheduler is that wp-cron.php is only executed when a user visits your website and triggers a page load. This means that WordPress requires an HTTP/HTTPS request from your website to run scheduled tasks. The cron task is then queued to be executed.

Therefore its best to to add a server-side Cron trigger for wp-cron.php.

Upvotes: 1

Related Questions