Reputation: 41
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.
Upvotes: 3
Views: 2100
Reputation: 883
As it was already mentioned before, you can deactivate starting Action Scheduler with WP Cron by removing this action hook:
remove_action( 'action_scheduler_run_queue', array( ActionScheduler::runner(), 'run' ) );
However, please keep in mind that Action Scheduler tasks still will be created.
You can prevent them from being created with hooks like these:
add_filter( 'pre_as_schedule_single_action', '__return_false' );
add_filter( 'pre_as_schedule_recurring_action', '__return_false' );
Anyway, more info you can find here https://rudrastyh.com/woocommerce/disable-action-scheduler.html
Upvotes: -1
Reputation: 389
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' ) );
}
}
Upvotes: 0