Question

I am running a particular WordPress cron job which takes a lot of time to complete as it does remote requests.

I want to increase the max_execution_time of only this task.

If I use ini_set() inside the cron function like the following will it work?

wp_schedule_event( time(), 'daily', 'cronjob' );

add_action( 'cronjob', 'cronjob_func' );

function cronjob_func() {
    @ini_set( "max_execution_time", 600 );
    //Rest of the code
}
Was it helpful?

Solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top