You’ll occasionally encounter errors or warnings in WordPress. One of these errors you may encounter is the WordPress max_execution_time fatal error.

Coming across an error like this may throw you off balance. There’s good news as this is a common error. It doesn’t occur often, but when it does, there are several quick solutions.

Let’s dig in!

Prefer to watch the video version?

What’s the WordPress max_execution_time Error?

The WordPress max_execution_time fatal error looks like this in your WordPress admin dashboard:

WordPress max_execution_time error
The maximum execution time error in the dashboard

The entire error message reads:

"Fatal Error: Maximum execution time of 30 seconds exceeded"

The 30 seconds value can be any number. Usually, it’s between 30 and 60 seconds. This error is prone to pop up when installing or updating themes, plugins, or WordPress core.

Why Does the max_execution_time Error Happen?

Every WordPress site has a maximum execution time limit for processing server requests. It’s meant to minimize server abuse. This limit looks at all the PHP scripts running on your site and blocks those running past the time limit.

Because WordPress site files mainly use PHP, it’s essential to keep an eye on PHP scripts to see if they run for too long and eat up too many server resources. It’s not uncommon for malicious attacks to utilize neverending PHP scripts to bring the site to a crawl.

Besides, some plugins, themes, or other WordPress elements can strain server resources if they take too long to run. Plugins seem to trigger this error message more often than other elements—likely because WordPress users install plugins more frequently than they modify code or install themes. Furthermore, plugins come from all sorts of developers, so it’s harder to check out the good ones backed by solid code and frequent updates.

Regardless of the cause, there aren’t many reasons to have a PHP script running for a significant amount of time; therefore, a maximum execution time limit is in place. Your hosting company usually sets this limit at the server level.

What’s the Standard Maximum Execution Time Limit?

Most hosting companies enforce a max execution time that’s anywhere between 30 and 60 seconds. This range gives your PHP scripts enough time to complete their jobs, even if they take some time to execute.

In general, a 30-second time limit should work well for high-quality PHP scripts. However, you may need to increase the limit to 60 seconds, depending on your code and server response. Some developers may opt for as much as a 300-second maximum, but anything over that isn’t a wise decision.

You may wonder: is it possible to have a website where PHP scripts take longer, yet they don’t cause any harm to the server?

Yes—some resource-heavy websites can’t help but reach longer execution times. However, it would be best to assume that maybe a plugin, theme, or other integration is causing the problem before jumping to different, less savory conclusions. It’s also possible your site may require a more powerful server, especially if you currently utilize a shared hosting setup.

Sometimes hosting companies may set the maximum execution time too low for your site. It’s a pretty common situation, and you can resolve it by reaching out to your hosting provider.

But It Says “Fatal Error”: That Sounds Bad

The “fatal error” text sounds urgent, but your website isn’t at risk of never working again. The max_execution_time WordPress error is one of the most common warnings seen in WordPress.

However, you may find a message on your site’s frontend, telling users that the site is experiencing technical difficulties.

That’s a problem—you could lose sales, leads, or readers if the warning message blocks your content and remains active for any length of time.

How to Figure out if a WordPress max_execution_time Error Occurred

The primary way to see if you’ve exceeded the maximum execution time is by checking for the message in your dashboard while uploading a plugin, theme, or WordPress update.

The installation or update page renders information about the change and gives you a “Success” or “Failure” message. The “fatal error” message is an option as well.

WordPress max_execution_time error
Fatal error message inside the dashboard

Another way to identify a maximum execution error is by seeing the frontend message to users, which reads, “The site is experiencing technical difficulties.”

frontend message for WordPress max_execution_time
Frontend message about technical difficulties

There are other variations of this message, some of which talk about critical errors and include a link to learn about debugging.

alternative WordPress max_execution_time message
Alternative frontend message on newer WordPress versions

Finally, WordPress usually sends the site admin an email explaining that a plugin or theme has caused a fatal error. The email will also provide a link to help you find a solution to the problem, usually by deleting the problematic plugin or theme or increasing your maximum execution time limit.

email from WordPress for WordPress max_execution_time
An email from WordPress on how to fix the max execution error

For all errors that result in “technical difficulty” messages, be sure to read our guide on resolving those problems. To focus on fixing the max execution time error in particular, though, read on.

How to Fix the max_execution_time WordPress Error

As mentioned, the max_execution_time WordPress error appears after a plugin, theme, or WordPress update takes too long to run a PHP script.

You’ll see the error notice in several areas. If you have trouble accessing your website, the fatal error email you received has a link to launch your WordPress instance in Recovery Mode.

WordPress in recovery mode
Recovery Mode allows you to access the dashboard and remove problems like plugins.

There are several ways to fix the max_execution_time WordPress error:

  • Identifying and uninstalling the plugin, or theme, or other resources that caused the error in the first place. It’s done in Recovery Mode or by removing the plugin via FTP.
  • Increasing the max execution time in the WordPress dashboard through a plugin.
  • Modifying the maximum execution time in wp-config.php.
  • Increasing the max execution time in the .htaccess file.
  • Changing the max execution time in the php.ini file.
  • Asking your hosting provider to increase the maximum execution time.

Uninstalling a plugin or theme is often the fastest method, but we’ll cover all the options below.

Uninstall the Problem Item

This solution removes the max execution error, but it doesn’t increase the max execution time. Therefore, it’s only a suitable option if you decide you’re willing to find a replacement for the offending plugin or theme.

If you’d instead increase the max execution time to allow room for a plugin or theme, move onto the following sections.

Those interested in removing the problem item (e.g., theme or plugin), follow the directions below.

To begin, do your best to identify where the trouble’s coming from with the following methods:

  • Uninstall the most recently installed item, especially if the error occurred right after installing a plugin or theme or updated to the most recent version of WordPress.
  • Check your email inbox to see if WordPress sent you an email about the fatal error. Sometimes they include information about which plugin caused the problem in the first place.
  • If you have no idea which item caused the error, we recommend deactivating each plugin, then reactivating them one by one, refreshing each time to catch which one creates the error.

After you identify the problem item, you should uninstall it from your WordPress site.

To complete this process, read our article on uninstalling a WordPress plugin. The guide highlights how to remove a plugin using the dashboard, an FTP client, and more.

Uninstalling via the dashboard makes the most sense for rapid removal, but uninstalling a plugin or theme via FTP comes in handy if you can’t gain access to the WordPress dashboard. You also have the option to get into the dashboard using Recovery Mode. WordPress includes a link to the Recovery Mode in the email you’ll receive.

Finally, you may find that a recent WordPress version upgrade caused the error. Use our guide on how to downgrade the WordPress version to troubleshoot this. In general, the WordPress version shouldn’t be the root cause—it’s usually a plugin or theme that isn’t working well with the new WordPress version.

How to Increase the Max Execution Time in WordPress (Using a Plugin)

Another option involves increasing the max execution time to give the PHP scripts in your plugins and themes more time to work.

Again, the maximum execution time is there for the security of your site and server, so it’s best not to increase it to accommodate a poorly coded plugin or theme. However, you may find that your hosting company sets short execution times, or you may need a little extra time.

In those cases, it’s acceptable to increase the max execution time to get rid of the WordPress max_execution_time error and to minimize the chances of the error coming up again in the future.

One way to change the max execution time is by installing a plugin via your dashboard that makes changes to configuration files without you going into the WordPress files. We like this option for those not comfortable using an FTP client, but only if you have access to the site’s dashboard.

Some security and optimization plugins, like Google PageSpeed Insights, have options to increase the max execution time.

Another plugin that’s focused exclusively on the max execution time is called WP Maximum Execution Time Exceeded. We recommend trying this one out since it automatically rewrites the .htaccess file to increase the maximum limits.

WP Maximum Execution Time Exceeded Plugin
WP Maximum Execution Time Exceeded plugin.

There’s nothing to do on your end; install and activate the plugin to make it work.

only install the plugin to solve WordPress max_execution_time
You only need to install and activate the plugin—nothing more

By default, the plugin provides a 300-second delay instead of whatever you had in the first place, which should give your site’s theme and plugins more than enough time to run their PHP scripts.

Finally, uninstall the plugin if you ever want to remove the increased time limit.

How to Increase the Max Execution Time in wp-config.php

Each of the following methods taps into your core WordPress files. We recommend accessing your WordPress site files via FTP/SFTP and modify the content within them.

As for handling the WordPress max_execution_time error, one way to solve the issue requires you to open the wp-config.php file.

Open an FTP connection to your WordPress files. Find and open the root folder (usually named after your site) and click on the /public folder.

The /public folder contains an extensive collection of core files, including wp-config.php.

Click on wp-config.php to either edit it directly in the FTP client or save it to your computer for editing.

Find the wp-config file
Find the wp-config file.

Place the following bit of code in the wp-congfig.php file:

set_time_limit(300);

It usually doesn’t matter where you place the code as long as it doesn’t modify anything already in the file. We recommend finding the last area right before “stop editing” and putting the code right there.

new time limit for WordPress max_execution_time
Set a new max execution time in wp-config

After that, save and upload the new wp-config.php file to your site via FTP. The new maximum execution time for this example is 300 seconds, but you can modify that number depending on what you need.

To make sure it worked, go back to WordPress to see if everything is now functioning. If the error doesn’t appear when you try to upload a plugin or theme, you’ve succeeded.

How to Increase the Max Execution Time in .htaccess

Kinsta doesn’t provide a .htaccess file since we use more performance-friendly Nginx servers, which don’t require .htaccess files. Click to learn more about why Kinsta doesn’t have a working .htaccess file, along with the benefits of Nginx.

Many other hosts—mainly shared hosting providers—still utilize Apache servers and therefore provide a .htaccess file within your root WordPress folder.

You can find that file much like you would the wp-config.php file: by connecting to your site via FTP and looking under the /public folder.

Again, you won’t be able to find it if you’re hosting your site on Kinsta. We recommend using the wp-config.php method for all Kinsta users.

htaccess to fix WordPress max_execution_time
Find and click .htaccess

It’s essential to backup your .htaccess file before editing it. Read this tutorial on how to backup your WordPress files.

Once backed up, open the .htaccess file for editing.

Add this line to the file:

php_value max_execution_time 300

Feel free to change the number to whatever maximum execution time you desire. Please save the file and upload it back into the /public folder in the FTP client. Finally, go back to your website to check if the matter has been resolved.

How to Increase the Max Execution Time in php.ini

Another file that’s not as common with web hosts is called php.ini. It’s another option for increasing your execution maximum, but more often than not, you’ll have an easier time using the wp-config.php method.

Yet, if you’re sure a php.ini file exists in your root folder and the other methods don’t work for some reason, consider tapping into the php.ini file instead.

Much like the other methods, you can usually find the php.ini file in the /public folder. Access this by going through an FTP client.

Open that file for editing.

locate the php.ini file
Locate the php.ini file

Add this line to increase the max execution time:

max_execution_time = 300

As always, change the number to meet your own needs, and remember to test out if it worked by re-uploading the problem item and checking to see if all error messages have gone away.

Contact Your Hosting Provider to Request an Increase in Maximum Execution Time

Running a WordPress site on a dedicated server means you have complete control over the maximum execution time. Therefore, the previous methods should work. You also may find that you can manually change the max execution time with other types of hosting like managed or VPS hosting.

Many shared hosting companies restrict your ability to modify the max execution time limit to protect the overall server being shared with many other apps and websites.

If you either don’t want to mess with it or you’re having trouble increasing the max execution time, you must contact your hosting provider and request they increase it for you.

Reach out to your host’s support team and tell them you see the WordPress max_execution_time error. Then, ask what your current max execution time is. Finally, request that they increase your limit, preferably to somewhere between 60 and 300. Remember that you should remove any plugin or theme that takes longer than that.

Summary

The WordPress max_execution_time error occurs due to slow PHP scripts, most often appearing within plugins, themes, and the occasional WordPress version update.

You may see this error inside the WordPress dashboard, along with a potential “technical difficulties” message on the frontend and an email from WordPress about the situation.

It’s a super common error. By following the steps we’ve covered here, you can have your site running normally again in a matter of minutes.

Salman Ravoof

Salman Ravoof is a self-taught web developer, writer, creator, and a huge admirer of Free and Open Source Software (FOSS). Besides tech, he's excited by science, philosophy, photography, arts, cats, and food. Learn more about him on his website, and connect with Salman on Twitter.