Reputation: 433
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
}
Upvotes: 3
Views: 2025
Reputation: 180004
Per http://php.net/manual/en/info.configuration.php#ini.max-execution-time, yes, unless safe mode is enabled.
Upvotes: 2