The WordPress message Allowed memory size exhausted means a PHP request used more memory than the server allows. It may appear when you open the dashboard, edit a post, process an image, run a WooCommerce task, or update a plugin.
Increasing the memory limit may restore access, but it does not explain why the request needed so much memory. A plugin conflict, inefficient custom code, oversized import, or resource-heavy background task may still be present. A better fix is to confirm the active limits, raise them carefully if appropriate, and identify the process causing the spike.
Create a backup of your files and database before changing configuration files. The guide How to Create and Restore a WordPress Backup Using cPanel explains a practical backup process.
What the WordPress memory error means
PHP assigns a memory limit to each request. When a script reaches that limit, PHP stops execution and reports an error similar to:
Fatal error: Allowed memory size of 134217728 bytes exhausted
The number is measured in bytes, so 134217728 bytes equals 128 MB. This is not necessarily the total RAM available to your hosting account. It is the maximum memory assigned to one PHP request.
WordPress has its own memory constants, but the hosting provider and PHP configuration can impose a lower limit. A setting in wp-config.php cannot always override a server-level restriction.
Identify when the error occurs
Record the exact action that triggers the failure. The pattern can help narrow the search:
- Only the admin area fails: a plugin dashboard, editor, backup tool, or security scanner may be using too much memory.
- Only the front end fails: check the active theme, page builder, shortcodes, and front-end integrations.
- Media uploads or image processing fail: large image dimensions or thumbnail generation may be responsible.
- WooCommerce actions fail: imports, reports, checkout extensions, and scheduled actions can create large requests.
- The problem began after an update: investigate the updated plugin, theme, PHP version compatibility, and new integrations.
If the site displays a generic critical error instead, follow How to Fix the WordPress Critical Error for recovery and debugging steps.
Check the active WordPress and PHP memory limits
In WordPress, open Tools > Site Health > Info, expand the Server section, and review the PHP memory limit. The WordPress Constants section can also show whether WordPress-specific limits are defined.
For a temporary diagnostic check, create a PHP file containing phpinfo(); and access it from a protected or temporary location. Delete the file immediately afterward because it can expose server details. If you do not have a safe way to do this, ask your host for the active PHP memory limit and whether your account can change it.
Check the error log as well. In cPanel, it may be available under Metrics > Errors, although the location varies by host. The plugin or file named near the memory message is useful evidence, but it is not always the underlying cause.
Increase WordPress memory in wp-config.php
Back up the site, then edit wp-config.php in the WordPress root directory. Add these lines above the comment that says That's all, stop editing!:
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );
WP_MEMORY_LIMIT mainly applies to standard WordPress requests, while WP_MAX_MEMORY_LIMIT is used for administration and some heavier operations. Do not add duplicate definitions. If the constants already exist, change their values instead.
These values are recommendations, not guarantees. Your host may enforce a lower PHP limit, and assigning a larger value does not create additional physical memory. On shared hosting, ask the provider which limits your account supports before increasing the setting.
Change the PHP limit at the hosting level
If WordPress still reports a lower value, use your hosting control panel to change the PHP setting. Depending on the server, the option may be called PHP Options, MultiPHP INI Editor, or Select PHP Version. The setting usually looks like this:
memory_limit = 256M
Save the change and check Site Health again. Some hosts require a PHP-FPM restart or a support request. On servers that permit local configuration, a php.ini or .user.ini file may work, but the correct method depends on the hosting stack.
Do not assume that adding php_value memory_limit 256M to .htaccess is safe. It is incompatible with some PHP-FPM and managed hosting environments and can cause a 500 error. Use the hosting panel or ask support before applying server-specific directives.
Find plugin and theme conflicts
After raising the limit, test for conflicts. Update WordPress, the active theme, and plugins from trusted sources, clear relevant caches, and repeat the action that caused the error.
Use a controlled isolation process
- Back up the site and use staging if available.
- Deactivate all plugins.
- Repeat the action that caused the error.
- If the error disappears, reactivate plugins one at a time.
- Test after each activation until the problem returns.
- If the problem remains with plugins disabled, temporarily switch to a default WordPress theme.
When the dashboard is inaccessible, use your hosting file manager or SFTP. Rename wp-content/plugins to something such as plugins-disabled to deactivate all plugins. After regaining access, restore the original folder name and investigate the plugins individually. Do not delete plugin folders unless you have confirmed they are unnecessary and have a backup.
For custom plugins, inspect loops, large database queries, unbounded API responses, image manipulation, and code that loads every post or order into memory. Prefer pagination and limited queries. For example:
$query = new WP_Query( array(
'post_type' => 'product',
'posts_per_page' => 20,
'paged' => max( 1, get_query_var( 'paged' ) ),
'fields' => 'ids',
) );
This example does not solve every memory problem, but it avoids loading complete post objects when the code needs only IDs. If you maintain custom code, How to Create a Custom WordPress Plugin provides a safer development foundation.
Review scheduled tasks, imports, and WooCommerce jobs
Memory errors can occur during scheduled operations rather than normal page views. Review backup jobs, security scans, image optimization, product imports, email queues, and WooCommerce scheduled actions. Run large imports in smaller batches and avoid running several demanding jobs at the same time.
If scheduled work is unreliable, review How to Fix WordPress Cron Jobs. A real server cron job can be more predictable than visitor-triggered WP-Cron, but the underlying task still needs efficient code and reasonable batch sizes.
Why more memory is not always the complete fix
Increasing PHP memory can temporarily hide a plugin bug, runaway loop, or inefficient query. After restoring the site, monitor logs, repeat the affected workflow, and remove or replace the extension responsible. Review caching and broader performance practices with Speed Up WordPress Without Breaking Your Site.
Frequently asked questions
What is a reasonable WordPress memory limit?
There is no universal value. A basic site may need less than a store using imports, page builders, or complex extensions. Start with the limit supported by your host and increase it only when a real workload requires it.
Why did changing wp-config.php not work?
The hosting-level PHP memory_limit may be lower, the constant may be duplicated or placed incorrectly, or the server may ignore local overrides. Confirm the active value in Site Health or ask your hosting provider.
Can one plugin cause the entire site to fail?
Yes. A plugin runs within the PHP request that loads it. If it consumes the available memory, that request can fail even when the rest of WordPress is working normally.
Should I disable all plugins permanently?
No. Disable plugins for diagnosis, then reactivate compatible extensions one at a time. Replace the plugin that consistently triggers the error or contact its developer with the relevant log details.
Conclusion
Fix the problem in stages: record the failing action, confirm the active PHP and WordPress limits, increase memory within your hosting plan, and isolate plugins, themes, and scheduled jobs. The lasting solution is usually a suitable memory limit combined with more efficient or compatible code—not simply the largest possible number.
