Opened 11 years ago
Closed 11 years ago
#27087 closed defect (bug) (invalid)
wp_schedule_event will not accept class hook
Reported by: | jonshipman | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.8.1 |
Component: | Cron API | Keywords: | |
Focuses: | administration | Cc: |
Description (last modified by )
wp_schedule_event
will not accept array() for the hook (must be string). As such, wp_schedule_event( time(), 'daily', array($this,'hook') );
will not work, however, moving the hook method outside of the class will work as the $hook
is no longer an array.
Change History (1)
Note: See
TracTickets for help on using
tickets.
You are mixing up "hook" and "callback" here.
wp_schedule_event
indeed requires a string as the "hook", in the sense of plugin action hook. You can then attach a "callback" (usually a function or class method) to that action hook: