How to increase WordPress memory limit

Last Updated On
Photo of author
Written By WPCubicle Team

If you are trying to find out how to increase WordPress memory limit, I am guessing you just saw this memory exhausted error, right?

Fatal error: Allowed memory size of 134217728 (which means 128MB or some other number) bytes exhausted

Actions that usually trigger this memory limit error on your WordPress website –

  1. While trying to upload some large size images or files
  2. While trying to install or update a plugin (usually the culprit) or a theme
  3. While submitting a form on your website

Why am I seeing this memory exhausted error on my WordPress website?

The server on which your website is hosted, usually sets a memory limit for PHP scripts. WordPress is based on PHP scripts, so the memory it can use is influenced by this limit.

How to fix memory size exhausted error in WordPress

Step 1: Check your current memory limit

If you are using WordPress 5.2 or later, you can check the current limit from your WordPress dashboard.

a. Log in to your WordPress website as admin to see your Dashboard

WordPress Dashboard after logging in

b. Navigate to Tools->Site Health in the left side menu

c. Click on ‘Info’ tab and then ‘Server’

how to increase WordPress memory limit

Step 2: Increase the memory limit by editing the wp-config file

a. Locate the wp-config.php file

If your memory limit is less than 256MB, you might want to increase the limit by editing the wp-config file. If your hosting provider allows you to use cpanel to access your files, you can look for it in the WordPress root folder (at the same level as wp-content,wp-admin, wp-includes etc.)

b. Edit the file

Look for the line

define( 'WP_MEMORY_LIMIT', '128M' );

Change 128 to 256MB (that should really be enough) and save the file. But if it still doesn’t help, then you should consider investigating which plugin or theme is using up all your memory resources and causing your website to exceed the limits.

In Conclusion

Now that you know how to increase WordPress memory limit, your website should be back to normal. However, if you want to find out the root cause, you could consider analyzing your WordPress logs for error messages.

Leave a Comment

Signup to WPCubicle's Newsletter (1 Email a Month)

* indicates required