WordPress Memory Limit Error? How to Increase PHP Memory

WordPress

WordPress Memory Limit Error? How to Increase PHP Memory

Learn what causes the WordPress memory exhausted error, how to increase the limit safely, and how to find the component using too much memory.

By Xenoy··Updated September 19, 2026
WordPress Memory Limit Error? How to Increase PHP Memory

An “Allowed memory size exhausted” error means a PHP request needed more memory than the server allowed. It may appear during an import, image upload, plugin update, page-builder edit, or ordinary page load.

Increasing the limit can restore the site, but it should not be the only step. A badly behaving plugin can consume any new memory you provide.

Record the Complete Error

Copy the error into a private note. The final file path often identifies the plugin, theme, or WordPress process involved. Do not post the full path publicly because it may reveal server information.

If visitors can see PHP errors, disable public error display after collecting the details. Use a protected log instead.

Check the Current Limit

Open Tools → Site Health → Info → Server and look for the PHP memory limit. Your host may show a different value in its control panel, so compare both.

The official WordPress PHP optimization guide explains that WP_MEMORY_LIMIT is the amount WordPress requests for frontend work, while WP_MAX_MEMORY_LIMIT applies to more demanding administration tasks.

Increase Memory in wp-config.php

Back up wp-config.php, then add this line before the comment that tells you to stop editing:

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

For administration tasks, you may also see:

define( 'WP_MAX_MEMORY_LIMIT', '256M' );

These values are examples, not universal recommendations. Your host can enforce a lower server limit, and WordPress cannot override it. Choose a level supported by your hosting plan rather than setting an unnecessarily large number.

Ask the Host When the Value Does Not Change

Some hosts require changes through a PHP settings panel or php.ini; managed hosting may require support assistance. Send the host the exact error, time, affected URL, and requested limit.

Do not add php_value directives to .htaccess unless the host confirms they are supported. On an incompatible server, they can take the site offline.

Find the Real Memory Consumer

After access returns, reproduce the action on staging while monitoring the PHP log. Consider what changed recently:

  • A plugin or theme update
  • A large import or backup
  • Oversized image processing
  • A complex page-builder layout
  • A report that loads thousands of records
  • Repeated background jobs

Deactivate the suspected component on staging and repeat the test. If memory use drops sharply, update, replace, or report the component rather than relying permanently on a higher limit.

Reduce Unnecessary Work

Delete unused plugins, process imports in smaller batches, resize extreme images before uploading, and avoid running backups or reports at the busiest time. Database cleanup may help overall efficiency, but it does not directly repair a PHP memory leak.

When More Hosting Resources Are Reasonable

A busy WooCommerce store or membership site genuinely needs more resources than a small brochure website. If legitimate traffic and tasks regularly reach the plan’s limits after optimization, upgrading the hosting environment may be the right fix.

Conclusion

Raise the memory limit carefully to regain access, then use logs and staging tests to identify why the request needed so much memory. A stable solution gives WordPress enough capacity without allowing one inefficient component to remain hidden.

X

About the author

Xenoy

View profile

Continue reading