Scheduling & run-once
Most snippets run on a WordPress hook on every page request. Scheduling and run-once let a PHP snippet run on a timer or exactly one time instead, independently of normal page loads.
Pro
Scheduling and run-once are SnipCraft Pro features. Both require an active Pro license to configure. They are only available for PHP snippets.Run-once
Run-once is a lightweight option for snippets that need to execute exactly one time. It is mutually exclusive with scheduling: a snippet can use one or the other, not both. Three modes are available:
- Now: runs the snippet immediately when you enable it, then disables it. It never fires on a page load.
- Next: runs the snippet once on the very next page load, then disables it. Useful when you need full request context (current user, queried object) to be available.
- None (default): no run-once behaviour; the snippet runs on every hook fire as normal.
Scheduled execution
Scheduled snippets run via WordPress cron. They never fire on a normal page load. The cron sweeper claims and executes them on each tick. Three schedule types are available:
- One-time: runs once at a specific date and time, then disables the snippet.
- Delayed: runs once a set number of seconds after the snippet is saved, then disables it. The minimum delay is 60 seconds.
- Recurring: runs repeatedly on a fixed interval (minimum 60 seconds). You can set an optional repeat count; 0 means unlimited. The maximum repeat count per snippet is 100,000 runs.
Related
To target a scheduled snippet to specific pages, users, or time windows, see run-when conditions. For the snippet types that support scheduling, see snippet types.