๐Ÿ› 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 ๐Ÿ™ˆ

Reset Post Time โ€” WP Post Scheduler

โฐ 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 ๐Ÿ™Œ

 

๐Ÿ’ปComputer Scientist | ๐ŸŒWeb Developer | โšก๏ธWordPress Core Contributor | โœ๏ธWannabe writer | ๐Ÿ“บSeasons Fanatic ๐Ÿ˜ฌ

Leave a Reply