1

What is the minimum time interval for which a cron can be scheduled? Is it 1 second or a minute?

3

WP-Cron ist not a fully fledged cron implementation or something. It's actually rather simple.

On every page load, a list of scheduled tasks is checked to see what needs to be run. Any tasks scheduled to be run will be run during that page load.

By default, tasks can be scheduled to be run hourly, twice a day or daily. That can be changed to anything though, see wp_get_schedules().

WP-Cron does not run constantly as the system cron does; it is only triggered on page load. Scheduling errors could occur if you schedule a task for 2:00PM and no page loads occur until 5:00PM. In that case, scheduling cron to run every minute is pointless and you should look at setting up a proper system cron job.

However, there's rarely a case where you need to set up a cron to run that often. Running it every 10 minutes or so should be totally fine.

3
  • I totally agree with your point @swissspidy. But just wanted to no is it even feasible to run a cron every second if in case website has really good page hit rate – beginner Feb 12 '18 at 9:18
  • You can do it, but don't expect your script to be called exactly once every second. – swissspidy Feb 12 '18 at 9:19
  • Is it because of wp-cron being triggered only on page load or other cron jobs in the wait queue. Is there any other reason for that? – beginner Feb 12 '18 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.