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');

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

everything works fine but, I would like to give user an option to interrupt it. Is there some way to do it ? By using schedule event ?

Or only make some solution with cache checking, and keep in cache some flag etc.

Your Answer

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

Browse other questions tagged or ask your own question.