Every time you schedule a post in WordPress for a specific time, it appears a few seconds late.Β I came upon this issue while working on a time sensitive website. I was trying to schedule a post to appear at a particular time β not even a second lateΒ β
β° Delay in Scheduled Post
I also noticed that the delay in seconds was abnormal, i.e., it varied from twenty to forty seconds. I tried talking to the support of my hosting and they said that this issue is occurring due to WordPress’ Cron job systemΒ ?
So I looked at the code responsible for setting the time of a scheduled post in WordPress Core. I found out that while the date and time β hours & minutes β are taken from the user as input, the seconds are set randomly.
β The Solution
There is a functionΒ βΒ touch_time
Β β in WordPress Core which is responsible for setting the post time of a normal as well as a scheduled post. This function is present inside wp-admin/includes/templates.php
. So I did a little testing and set the time second of my scheduled post to zero and boom π
My post appeared accurately at the specified time β not even a second late. So, I wrote a lightweight plugin to resolve this issue and I have made it open source so that anyone else facing the same problem can use this plugin to get rid of this issue π
π GitHub Link:Β https://github.com/asharirfan/reset-post-time
πΎΒ Click here to download it.
Happy Blogging π€
Muhd Hanis says:
How to install it on wordpress site?
July 15, 2021 — 9:56 am
Ashar Irfan says:
Use the download link above or download it from the GitHub repository. Then upload and install the zip file on your WordPress website from Dashboard > Plugins > Add New > Upload Plugin. Hope that helps, cheers!
August 8, 2021 — 11:10 pm
Gregg says:
Fantastic. Thank you.
October 18, 2023 — 1:40 am