How to get Wordpress to be more precise with posting time... ?
April 17, 2022 12:36 PM   Subscribe

I run a store where new product is posted to the front of my site (as blog entries) every day at 7PM. Sometimes 3 items but sometimes as many as 8. Even though everything is set to post at 7, some don't show until 701 or 702 or 703, etc. Is there a way to have the posts all be there by 701? Note that this happens no matter how few items I want to post.

Unsure if this has something to do with my host or Wordpress or I need a plug in or... ? My host is SiteGround.

Thanks!
posted by dobbs to Computers & Internet (9 answers total)
 
What is the mechanism that causes the new product to be posted at 7? Is it a plugin? If so, what is the plugin? Have you looked at the FAQ for that plugin?
posted by amtho at 1:07 PM on April 17, 2022


Almost certainly the trigger for the timing is WP Cron, which is not a continuous process. Out of the box it checks for things to do every time someone loads a page, so if you don't have someone actively checking your site at 7pm, you'll (generally) have to wait until someone loads a page.

This link talks about one approach to check for tasks on an ongoing basis:
https://developer.wordpress.org/plugins/cron/hooking-wp-cron-into-the-system-task-scheduler/



In fact, SiteGround has instructions on setting this up with their hosting system: https://www.siteground.com/tutorials/wordpress/real-cron-job/
posted by Nonsteroidal Anti-Inflammatory Drug at 1:12 PM on April 17, 2022 [6 favorites]


The issue is likely with WP Cron not running right at 7pm, see here for details. This could be because your site isn't getting enough traffic or for other reasons. If this is managed Wordpress hosting, it might be difficult to resolve yourself. You could try contacting your host — they may have some kind of custom cron setup running.
posted by ssg at 1:13 PM on April 17, 2022


I think it's probably OK to promise your new products will be posted between 7:00 and 7:05, or "by" 7:00 and set up a posting time of 6:45 or 6:55. Based on zero knowledge of your business of course - YMMV.
posted by amtho at 1:29 PM on April 17, 2022


Response by poster: The issue is I only have one of each product so exactly at 7 (actually starting at 659), 500 to 1500 people are looking at the site. If I don't say at what time they're going to be posted, people who missed out get very angry. I sell about 75% of my product within 5 minutes, but things definitely load inconsistently.

I will now read the links you folks posted. Just wanted to establish that info.
posted by dobbs at 1:34 PM on April 17, 2022


Yeah, WP-Cron has a few, uhhhh, "quirks".

One of the easiest ways to make sure things are running on time is to use a third-party site like Uptime Robot or Freshping that pings your site once every X minutes. Every minute would definitely do the trick, but every 5 minutes ought to be enough. (Plus you get notified if your site is down.)

You can also review the WP-Cron jobs to see if that is, in fact, the issue (though my money is that it is) by using WP-Crontrol. If, for some reason, the cron is running on-time but is still not showing up, this might have something to do with the SG Optimizer plugin, so you could test with that plugin disabled.
posted by juliebug at 2:13 PM on April 17, 2022 [2 favorites]


I was going to pass this by because a server-side cron seemed like the answer, but

so exactly at 7 (actually starting at 659), 500 to 1500 people are looking at the site.

Hm. That might set up a capacity issue and back things up, depending on how your host has its webserver set up, especially if people are hitting refresh-refresh-refresh waiting for the new item to show up. Do your users report slowdowns or timeouts when the items post?

So: do you have some kind of cache plugin enabled? Do you know if your host uses some kind of frontend cacheing proxy? It looks as though SiteGround has a bespoke config tool available [and, per juliebug, a WP Optimizer plugin]: are you using any of those?
posted by holgate at 2:40 PM on April 17, 2022


so exactly at 7 (actually starting at 659), 500 to 1500 people are looking at the site.

Hm. That might set up a capacity issue and back things up,


This is true and funny, because the opposite problem of "WP Cron isn't running on time because no one is loading pages" is "WP Cron is running 100 times a second". This can be OK if you have good PHP and database caching in place but it's usually just better in both cases to do "real cron" so it runs as needed, but not more and not less.
posted by Nonsteroidal Anti-Inflammatory Drug at 2:55 PM on April 17, 2022 [2 favorites]


I'd also investigate if WP has a way to post but not display (or only display to admin view). Then you put you things up like that at 6:45 and then at 7:00 it's just flipping the on bit to make it go live.

If I could/if it's even possible... I'd post hidden early and have a system cron that does a simple SQL update to flip them to active and hit a trigger if any for any cache layer (like set the cache expire time to in the past so new things get added immediately). But I usually end up "taking apart" things like that to figure out the database/cache sort of inner workings to I can mess with them directly.
posted by zengargoyle at 12:15 AM on April 18, 2022


« Older Free Streaming World Music Stations   |   tell me about southwestern vermont Newer »
This thread is closed to new comments.