2

I want to stop all my action scheduler when I am login in my wp-admin, instead of it I want to manage all cron should be handle by cron background of my server. is it possible please tell me the way I already spend lot of time to stop it from wp-admin ajax process.

Currently its working as below

The async queue runner initiates action processing when an admin user logs into the WordPress administration dashboard. It also uses loopback requests to process multiple batches of actions in a sequence of requests so that instead of processing actions in just one request, once a queue starts processing, it will continue to process actions in a new request until there are no actions to process, or loopback limits are reached.

So I just want to break this flow and instead of this I want to set my cron that can handle all the stuff so I don't need to login in my admin every time to run the all scheduler.

1 Answers1

0

Add this in your functions.php to disable Action Scheduler:

<?php
function just_disable_default_runner() {
    if ( class_exists( 'ActionScheduler' ) ) {
        remove_action( 'action_scheduler_run_queue', array( ActionScheduler::runner(), 'run' ) );
    }
}
hhh
  • 394
  • 2
  • 15
  • When is this function executed? – Jos Sep 08 '22 at 16:44
  • See this simple plugin for the source of that snippet - https://github.com/woocommerce/action-scheduler-disable-default-runner - you need to call it from an action hooked to ```init``` – Q Studio Oct 22 '22 at 13:00