[wp-trac] [WordPress Trac] #42660: Single event scheduler
WordPress Trac
noreply at wordpress.org
Fri Feb 2 15:22:50 UTC 2018
#42660: Single event scheduler
-------------------------------+----------------------
Reporter: skarabeq | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Cron API | Version: 4.9
Severity: normal | Resolution: invalid
Keywords: reporter-feedback | Focuses:
-------------------------------+----------------------
Changes (by mariovalney):
* status: reopened => closed
* resolution: => invalid
Comment:
Hi @skarabeq how are you?
A event scheduled with `wp_schedule_single_event` will run '''just one
time for each time you scheduled it''' (as @dd32 explained
[https://core.trac.wordpress.org/ticket/42660#comment:12 here]).
You have to make sure you will not call `wp_schedule_single_event`
function after the event runned.
If you want a event run just really once (and never again) the best way is
to run `wp_schedule_single_event` in a action will run just once (like
activating a plugin). If it's not possible, another solution would be add
a entry in database (before it run to avoid parallel events and after it
run to say "it's done: never schedule this again").
P.S: [https://www.useloom.com/share/6e9f4b410a394eb4ab889bce7e9a6c0b A
video with a test you can do.]
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42660#comment:21>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list