wp_schedule_event in a class
-
This is my (stripped down) plugin, in OOP:
class MyClass { public function __construct() { // scheduled tasks if ( !wp_next_scheduled( 'dailyops' ) ) { wp_schedule_event( time(), 'daily', 'dailyops' ); } add_action( 'dailyops', array($this, 'do_this_daily') ); } function do_this_daily() { // do something every day error_log('daily'); } }Anyway, it’s not working (do_this_daily() is never fired). I tried the same in a non-OOP plugin (not based on a class) and it works flawlessy. How can I make it work here, in a class?
The topic ‘wp_schedule_event in a class’ is closed to new replies.