wp_schedule_event is executing but the function related to the hook is not running

So your constructor is probably not being executed before the cron event is being run. If your instantiating the fb_linter class too late then your call to add_action won’t happen in time. Try using the singleton design pattern for your class and then instantiate it right after you declare it and it should work just fine.

something like

class fb_linter {
    public static function get_instance(){
        static $instance;
        if( ! isset( $instance ) )
            $instance = new self();

        return $instance;
    }

    ...
}
fb_linter::get_instance();

Leave a Comment