admin-plugins author calendar category facebook post rss search twitter star star-half star-empty

Tidy Repo

The best & most reliable WordPress plugins

How to Increase WordPress Memory Limit: WP_MEMORY_LIMIT vs PHP memory_limit for Managing Site Resources

How to Increase WordPress Memory Limit: WP_MEMORY_LIMIT vs PHP memory_limit for Managing Site Resources

Ethan Martinez

October 15, 2026

Blog

Raise WordPress memory in the right layer first: increase WP_MEMORY_LIMIT for WordPress, but check PHP memory_limit because that is the ceiling PHP enforces. WordPress commonly uses 40M for single sites and 64M for multisite as default memory constants, while admin tasks may use a higher limit such as 256M through WP_MAX_MEMORY_LIMIT [source: WordPress Developer Resources]. If your site shows fatal memory errors, slow admin screens, failed imports, or broken backups, treat memory as a controlled resource, not a random number to keep raising.

TLDR: Set WP_MEMORY_LIMIT in wp-config.php to help WordPress handle plugins, themes, page builders, imports, and admin work, but confirm that PHP memory_limit is equal or higher. For example, if WooCommerce order exports fail at 128 MB and finish at 256 MB, raising only the WordPress constant may not work if PHP is still capped at 128 MB. A practical setup is WP_MEMORY_LIMIT at 256M and PHP memory_limit at 256M or 512M, depending on hosting and traffic. If errors return within days, the real problem may be a heavy plugin, bad query, or bloated background task.

What WordPress memory limit actually means

WP_MEMORY_LIMIT is a WordPress constant. It tells WordPress how much memory it should try to use during normal front-end and back-end requests. You usually define it in wp-config.php.

Example:

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

This helps when WordPress runs out of memory during plugin updates, imports, media processing, checkout flows, or large admin screens. The familiar error often looks like this:

Fatal error: Allowed memory size of 134217728 bytes exhausted

That number is not random. 134217728 bytes is 128 MB. If you see it, PHP hit its allowed memory cap.

The catch is, WordPress can ask for more memory, but PHP and the hosting server decide whether that request is allowed. That is where many fixes fail.

WP_MEMORY_LIMIT vs PHP memory_limit

WP_MEMORY_LIMIT is controlled by WordPress. memory_limit is controlled by PHP. They are related, but they are not the same setting.

  • WP_MEMORY_LIMIT: Sets the memory target WordPress tries to apply for WordPress requests.
  • WP_MAX_MEMORY_LIMIT: Applies to heavier admin tasks, image handling, updates, and similar operations.
  • PHP memory_limit: Sets the actual PHP process memory ceiling.

If PHP allows 128M and WordPress asks for 256M, the higher WordPress value may not work. Some hosts allow WordPress to raise the runtime memory limit. Others block it. Shared hosting plans often restrict this more tightly.

The PHP manual describes memory_limit as the maximum amount of memory a script may consume [source: PHP manual]. That wording matters. WordPress runs on PHP, so PHP always has the final say.

Recommended memory settings for most sites

There is no perfect value for every site. Still, these ranges are sensible starting points:

  • Small blog or brochure site: 128M
  • Business site with several plugins: 256M
  • WooCommerce or membership site: 256M to 512M
  • Large imports, page builders, or multilingual sites: 512M, if the server can support it

Do not raise memory to hide a broken setup. A simple five-page website should not need 1024M. If it does, expect a plugin conflict, large autoloaded options, oversized images, slow database queries, or a theme doing too much work on each page load.

How to increase WP_MEMORY_LIMIT

The safest first step is editing wp-config.php. This file sits in the root folder of your WordPress installation.

  1. Connect by SFTP, SSH, or your hosting file manager.
  2. Open wp-config.php.
  3. Add the setting above the line that says /* That's all, stop editing! */.

Use this:

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

For admin tasks, you can also add:

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

Keep the values realistic. If the site sits on a small shared plan with limited RAM, setting 1024M will not create more server memory. It may also make crashes less predictable under traffic.

How to increase PHP memory_limit

If changing WP_MEMORY_LIMIT does nothing, check PHP. The method depends on hosting.

  • Hosting control panel: Look for PHP settings, MultiPHP INI Editor, Select PHP Version, or similar wording.
  • php.ini: Add or edit memory_limit = 256M.
  • .user.ini: On many PHP-FPM setups, use memory_limit = 256M.
  • .htaccess: On some Apache setups, use php_value memory_limit 256M. This can break the site if the server does not allow it.
  • Managed hosting: Contact support if the setting is locked.

Honestly, it can be irritating when a control panel shows 512 MB, WordPress reports 256 MB, and PHP still fails at 128 MB. That usually means there is another PHP configuration file, a pool-level rule, or a host-level cap overriding your change.

How to check the active memory value

Do not guess. Verify.

  • Open Tools > Site Health > Info in WordPress.
  • Check the Server section for PHP memory limit.
  • Check WooCommerce status if you run WooCommerce.
  • Create a temporary phpinfo() file only if you know how to remove it after testing.

You can also ask your host to confirm the active value for your site’s PHP pool. That is often faster than testing blind for an hour.

Common signs that memory is too low

Low memory does not always show as a clean error message. Watch for these signs:

  • White screen after activating a plugin.
  • Backup jobs that stop before completion.
  • Product imports that freeze after a few hundred rows.
  • Page builder edits that spin for 20 seconds, then fail.
  • Admin pages that load much slower than the front end.
  • Image uploads that fail during resizing.

Memory issues often appear during heavy tasks, not basic page views. A site may seem fine until a plugin update, CSV import, or scheduled job runs.

When increasing memory is the wrong fix

More memory can stop an immediate crash. It does not always fix the cause. If memory use keeps climbing, review the site.

  • Audit plugins: Disable unused plugins. Replace heavy ones where possible.
  • Check autoloaded data: Large autoloaded options can hurt every request.
  • Review cron jobs: Failed scheduled tasks can pile up.
  • Optimize images: Huge originals can exhaust memory during thumbnail creation.
  • Inspect custom code: Loops, bulk queries, and unbounded API calls can burn memory fast.

A memory increase should give the site room to operate. It should not become a cover for waste. If a plugin takes 300 MB to render a basic settings page, the plugin deserves scrutiny.

Safe process for changing memory limits

Use a measured process. It reduces risk.

  1. Back up the site files and database.
  2. Record the current WP_MEMORY_LIMIT and PHP memory_limit.
  3. Raise WordPress memory to 256M.
  4. Match or exceed that value in PHP.
  5. Clear cache and retest the failing task.
  6. Check server logs for fresh memory errors.
  7. If errors remain, audit plugins and long-running tasks.

For serious stores and busy membership sites, test this on staging first. A bad .htaccess or PHP setting can trigger a 500 error. That is not fun during business hours.

Best practical setup

For most active WordPress sites, set WP_MEMORY_LIMIT to 256M. Set WP_MAX_MEMORY_LIMIT to 512M if your host allows it. Then make sure PHP memory_limit is at least equal to the highest value WordPress needs.

If you run WooCommerce, large imports, LMS plugins, multilingual plugins, or visual builders, start with 256M and monitor errors. Move to 512M only when there is a clear reason. If memory problems continue after that, stop raising numbers and investigate the workload.

The key rule is simple: WP_MEMORY_LIMIT tells WordPress what to request, while PHP memory_limit controls what PHP will allow. Set both with intent, verify the active value, and treat repeated memory errors as a performance warning, not just a configuration problem.