1

I am running background job by using add_action hook, hook starts on REST API CALL:

   if ( ! wp_next_scheduled( 'bg_job_hook' ) ) {
          wp_schedule_single_event( time(), 'bg_job_hook');
          get_headers(get_site_url());
    }

add_action( 'bg_job_hook', array( $this->$bg, 'do_background' ) );

it works fine, but I would to quit this job, so on another api call I add an option, and inside background job I get this option on every loop. I see that this quit option is updated in DB, but logs from loop shows me that not. If iteration quits, and I will background job again, it will after first loop because get_option shows true..

Why during loop it is not working ?

0

Ok for some reason caching works strange in WP :) So I resigned from using get_option, and I am doing pure SQL query to DB, and everything works fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.