Skip to content

Changing Max Execution time for php in WordPress

You might have heard that you may need to edit php.ini to change max execution time and other important variables for wordpress but there is no need of it as you can add the below line of code either to functions.php in your theme file or in my custom php functions plugin (which takes care of adding all your functions to functions.php)

The below code changes the maximum execution time of the script to 300 seconds before timing out the script

@ini_set( 'max_execution_time', '300' );

After 300 seconds, if the php script is still executing it will stop.