Opened 8 years ago
Closed 8 years ago
#41095 closed feature request (invalid)
wp_schedule_single_event should support any callable
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Cron API | Keywords: | |
Focuses: | Cc: |
Description
Hooking/filtering in WP core generally supports any callable variable, but wp_schedule_single_event only supports strings. I can see how instance methods wouldn't make sense here, but the static class methods in the array notation still make sense and should be supported.
Since the minimum PHP version for WP is earlier than support for namespaces, static class methods are often used to keep methods from cluttering the global method space. Preventing this use case here seems arbitrary and seems like an easy fix.
Change History (2)
Note: See
TracTickets for help on using
tickets.
This is a remarkably common misconception of how the CRON system actually works, but this is supported already.
wp_schedule_single_event()
does not accept a callable at all, it accept an action name. Often the hook specified is the same as the function being called, which doesn't help people realise what's actually being specified.wp_schedule_single_event( time() + 3600, 'my_plugin_func' );
does not work, it doesn't do anything without an additionaladd_action()
.It's used like this: