WordPress memory limit errors can prevent a website from loading correctly, cause the WordPress dashboard to crash, or produce messages such as “Allowed memory size exhausted.” These problems are especially common on websites using page builders, WooCommerce, image-processing tools, large plugins, or multiple resource-intensive features.
Increasing the WordPress memory limit can solve the problem, but simply raising the limit is not always the correct solution. If a plugin, theme, custom code, or WordPress process is consuming an unreasonable amount of memory, the underlying problem should be identified as well.
This guide explains what the WordPress memory limit actually means, how to diagnose memory errors, how to increase the limit safely, and how to find the real cause when increasing memory does not solve the problem.
What Is the WordPress Memory Limit?
The WordPress memory limit determines how much PHP memory WordPress is allowed to use while processing a request.
WordPress runs on PHP, and every PHP request requires memory to perform tasks such as:
- Loading WordPress core
- Loading the active theme
- Loading plugins
- Processing database results
- Generating pages
- Processing images
- Running WooCommerce operations
- Loading Elementor or other page builders
- Executing custom PHP code
- Processing AJAX and REST API requests
If a request requires more memory than PHP is allowed to use, PHP can terminate the process and return a memory-related error.
One of the most common messages looks similar to:
Allowed memory size of XXXXX bytes exhausted
This does not necessarily mean that your server has physically run out of RAM.
It usually means that the particular PHP process reached the memory limit imposed on it.
That distinction is important.
WordPress Memory Limit vs PHP Memory Limit
One of the most common sources of confusion is that WordPress and PHP have related but different memory settings.
PHP Memory Limit
PHP has a memory_limit setting that controls how much memory a PHP script can allocate.
For example:
memory_limit = 128M
means PHP is configured to allow a PHP process to use up to that amount of memory.
WordPress Memory Limit
WordPress can also define memory limits for its own requests.
Common constants include:
WP_MEMORY_LIMIT
and:
WP_MAX_MEMORY_LIMIT
The first is generally associated with normal WordPress requests.
The second is intended for administration-related operations where WordPress may need more memory.
For example, a WordPress installation might use:
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );
However, these values do not necessarily override the server’s PHP limit.
If the hosting environment only permits PHP to use 128 MB, setting WordPress to 512 MB does not magically give the PHP process 512 MB.
The actual limits depend on the hosting configuration and how PHP is configured.
Why WordPress Memory Limit Errors Happen
There is no single cause of a memory limit error.
Common causes include:
- Resource-intensive plugins
- Poorly optimized plugins
- Page builders
- WooCommerce
- Large image-processing operations
- Import or export tools
- Backup plugins
- Security scanners
- Database operations
- Large WordPress migrations
- Excessive PHP processes
- Custom PHP code
- Memory leaks
- Complex queries
- Large datasets
- Insufficient PHP memory allocation
- Poorly configured hosting
Sometimes a website simply needs more memory.
Other times, the memory limit is only exposing a deeper problem.
Common WordPress Memory Error Messages
You may encounter different versions of the same underlying problem.
One common example is:
Fatal error: Allowed memory size of ... bytes exhausted
Another may mention a specific WordPress file:
wp-includes/...
or:
wp-content/plugins/...
You might also see an error pointing to a theme file or custom PHP code.
The file mentioned in the error is useful, but it does not always mean that the file itself is the root cause.
For example, WordPress may reach its memory limit while loading a plugin even though the plugin was only the final component loaded before the limit was reached.
This is why the complete error message and the context in which the error occurs are important.
How to Check the WordPress Memory Limit
Before changing anything, find out what the website is currently using.
Check WordPress Site Health
Go to:
WordPress Dashboard → Tools → Site Health → Info → Server
Depending on the WordPress version and hosting environment, you may see information related to PHP memory limits and other server configuration values.
This is one of the easiest ways to get an overview without editing server files.
Check PHP Information
Your hosting control panel may provide PHP configuration information.
Depending on the hosting provider, this may be available through:
- PHP settings
- PHP options
- MultiPHP INI Editor
- PHP configuration
- Server information
Look for:
memory_limit
The exact interface depends on the hosting environment.
Check With a Small PHP Diagnostic
If you have developer access, PHP can report its current memory limit through:
echo ini_get( 'memory_limit' );
Do not leave diagnostic code publicly accessible on a production website.
Remove temporary diagnostic files after testing.
How Much Memory Does WordPress Need?
There is no single memory limit that is correct for every WordPress website.
A simple blog with a lightweight theme and a small number of plugins may require considerably less memory than a WooCommerce store using Elementor, advanced filtering, large product catalogs, and several integrations.
As a general starting point, many modern WordPress websites can work comfortably with a PHP memory limit such as 256 MB, while more demanding websites may require more.
However, the correct value depends on the workload.
Do not treat a larger number as automatically better.
If a website genuinely requires 1 GB of PHP memory for a normal request, increasing the limit may hide a problem that should be investigated.
How to Increase the WordPress Memory Limit
There are several possible methods.
Which method works depends on your hosting environment.
Method 1: Increase WordPress Memory in wp-config.php
The most common WordPress-level approach is editing the wp-config.php file.
Before the line:
/* That's all, stop editing! Happy publishing. */
you can add:
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );
The exact values should be appropriate for your website and hosting environment.
Do not add the same constant multiple times.
If the constant already exists, edit the existing value rather than creating another definition.
For example, if you already have:
define( 'WP_MEMORY_LIMIT', '128M' );
change that value instead of adding another line elsewhere.
Why WP_MAX_MEMORY_LIMIT Matters
WP_MAX_MEMORY_LIMIT is particularly relevant to administration processes.
Some WordPress operations performed in the dashboard can require more memory than normal frontend requests.
Examples include:
- Plugin operations
- Theme operations
- Image processing
- Updates
- Large administrative tasks
This is why both constants may be present on demanding websites.
Method 2: Increase PHP memory_limit
If the WordPress constant is not enough, the PHP configuration itself may need to be increased.
For example:
memory_limit = 256M
or:
memory_limit = 512M
The exact method depends on the hosting environment.
Some hosting providers allow customers to change this value through a control panel.
Others require support to make the change.
Some environments use php.ini, .user.ini, or other configuration mechanisms.
Do not assume that a setting available on one hosting platform will work on another.
Method 3: Change PHP Memory Through a Hosting Panel
Many hosting providers offer a graphical interface for PHP settings.
Depending on the hosting platform, you may find an option similar to:
PHP → Options → memory_limit
or:
MultiPHP INI Editor → memory_limit
Set the required value, save the configuration, and then check the website again.
If the setting does not change, your hosting provider may restrict the maximum value.
Method 4: Contact Your Hosting Provider
Sometimes the simplest solution is to ask the host.
You can tell them:
Please check the current PHP memory_limit for this website and whether it can be increased to 256M or 512M.
You can also ask whether there are account-level memory restrictions that prevent PHP from using additional memory.
This is particularly important on managed hosting, shared hosting, and other environments where customers do not have access to the complete server configuration.
Why Increasing wp-config.php May Not Work
A common mistake is assuming that this:
define( 'WP_MEMORY_LIMIT', '512M' );
automatically gives WordPress 512 MB.
It does not necessarily work that way.
The PHP environment can impose its own limit.
For example, if PHP is configured with:
memory_limit = 128M
then asking WordPress to use 512 MB does not necessarily allow a PHP process to exceed the server-level restriction.
This is why you should verify the actual PHP configuration after making changes.
Do Not Add the Same Constant Twice
Another common mistake is adding:
define( 'WP_MEMORY_LIMIT', '256M' );
multiple times.
For example:
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MEMORY_LIMIT', '512M' );
This is not a correct configuration.
Keep a single definition and make sure it is placed correctly.
If the website already contains these constants, edit the existing definitions.
What If the Website Is Still Showing the Error?
If increasing memory does not solve the problem, stop increasing the number repeatedly.
At that point, investigate the cause.
The most important question becomes:
What operation is consuming the memory?
Look at the complete PHP error.
If it identifies a plugin, theme, or custom file, use that information as a starting point.
Check the Plugin Mentioned in the Error
If the error points to something such as:
wp-content/plugins/example-plugin/...
the plugin may be involved.
This does not automatically prove that the plugin is defective.
The plugin could be processing a large dataset or performing an operation that legitimately requires more memory.
For example:
- Importing thousands of products
- Processing large images
- Generating a backup
- Scanning files
- Exporting data
- Rebuilding a large index
The context matters.
If the same plugin causes a memory error during a simple page load, however, further investigation is justified.
Test Plugins Systematically
If you suspect a plugin, temporarily deactivate plugins and test the affected operation.
On a production website, be careful.
Deactivating plugins can disable important functionality.
Whenever possible, perform troubleshooting on a staging environment.
A useful approach is:
- Record the current configuration.
- Test the problematic action.
- Temporarily deactivate non-essential plugins.
- Test again.
- Reactivate plugins systematically.
- Identify when the problem returns.
This can help isolate the component responsible.
Do not deactivate security, payment, or other critical plugins on a live store without understanding the consequences.
Check the Theme
The active theme can also consume memory.
This is particularly relevant with:
- Large multipurpose themes
- Complex theme frameworks
- Page-builder integrations
- Custom themes
- Themes containing extensive functionality
If the problem appears only on pages using a specific template, investigate the template and theme code.
On a staging environment, temporarily switching to a default WordPress theme can help determine whether the active theme is involved.
Elementor and Memory Limit Errors
Elementor websites can require more PHP memory than very simple WordPress installations.
This can become especially noticeable when working with:
- Large pages
- Complex templates
- Many widgets
- Dynamic content
- WooCommerce
- Custom integrations
- Large media libraries
- Multiple Elementor extensions
If Elementor reports a memory-related error, increasing the available PHP memory may help.
However, if the problem occurs only with a particular page or template, inspect that page as well.
A very large Elementor layout with excessive nested elements, dynamic queries, widgets, and third-party extensions can increase the amount of work required to generate or edit the page.
More memory is not a substitute for simplifying an unnecessarily complex page.
WooCommerce Memory Limit Problems
WooCommerce websites can have higher resource requirements because they handle products, orders, customers, cart sessions, checkout processes, and other dynamic operations.
Memory problems can appear during:
- Product imports
- Product exports
- Bulk editing
- Order processing
- Plugin integrations
- Checkout operations
- Product synchronization
- Large catalog operations
- Scheduled tasks
If a WooCommerce website needs additional memory for a specific bulk operation, increasing the PHP memory limit may be reasonable.
But if normal shop or checkout requests consistently consume excessive memory, investigate the plugins, theme, queries, and integrations involved.
Image Processing Can Require Significant Memory
WordPress frequently processes images when you:
- Upload images
- Generate thumbnails
- Regenerate thumbnails
- Resize images
- Convert image formats
- Optimize images
- Process large original images
A very large image can require significantly more memory to process than its compressed file size might suggest.
For example, a highly compressed JPEG might be only a few megabytes on disk while still requiring substantial memory when decoded and processed.
This is why image-processing operations can sometimes trigger memory errors even when the website otherwise works normally.
If memory errors appear while generating thumbnails or optimizing images, investigate the image dimensions and the tools performing the processing.
Backup and Migration Plugins
Backup and migration operations can also consume significant memory.
Depending on the implementation, these tools may need to process:
- Large databases
- Thousands of files
- Large media libraries
- Archives
- Serialized data
- Plugin settings
- Theme files
If a memory error occurs during a backup or migration, increasing the memory limit may help.
However, for very large websites, server resources, execution time, disk space, and upload limits can become just as important as PHP memory.
Database Operations and Memory Usage
Database-related operations can also contribute to memory consumption.
A plugin might request a large number of database records and then attempt to process them all in PHP.
This can consume significantly more memory than retrieving and processing smaller batches.
For example, a poorly designed operation might load thousands of records into memory at once instead of processing them incrementally.
If a memory error occurs during a database-heavy operation, increasing memory may provide temporary relief, but the underlying code or query may still need optimization.
Use Query Monitor to Investigate Resource Usage
Query Monitor is a useful development and troubleshooting tool for investigating WordPress performance.
It can help you examine information such as:
- Database queries
- Slow queries
- PHP errors
- Hooks and actions
- HTTP requests
- Loaded scripts and styles
- Request information
It is particularly useful when a website has a performance or resource problem that is not obvious from the frontend.
Query Monitor should generally be used carefully on production websites, especially on high-traffic websites, because debugging tools add overhead and can expose information to users with the appropriate access.
Use it primarily while diagnosing a problem and disable or remove it when it is no longer needed.
Check PHP Error Logs
PHP error logs can provide information that the WordPress dashboard does not show.
Your hosting provider may provide access through:
- Hosting control panel
- PHP logs
- Error logs
- Server logs
- Application logs
Look for:
Allowed memory size exhausted- Fatal PHP errors
- Plugin-related errors
- Theme errors
- Repeated warnings
- Errors occurring at the same time as the failure
The exact location and format of logs depend on your hosting environment.
Check WordPress Debugging
For development and staging environments, WordPress debugging can provide additional information.
A common configuration is:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
This allows errors to be logged without displaying them publicly on the website.
The log is commonly written to:
wp-content/debug.log
Do not enable verbose debugging carelessly on a production website.
Error output can reveal sensitive technical information to visitors.
If you enable debugging temporarily, disable it after troubleshooting or use an appropriate production-safe logging configuration.
Memory Errors During WP-Cron
WordPress scheduled tasks can also trigger memory-related problems.
WP-Cron may execute operations such as:
- Scheduled backups
- Email processing
- WooCommerce tasks
- Product synchronization
- Plugin maintenance
- Database cleanup
- Scheduled imports
A website may therefore appear normal when visited by a user while a background scheduled task repeatedly fails because it exceeds available resources.
If memory errors appear periodically rather than during normal page loads, inspect scheduled tasks and server logs.
REST API and AJAX Requests Can Also Fail
Not every memory error happens during a normal page request.
WordPress uses AJAX and REST API requests for many administrative and frontend functions.
Examples include:
- Page-builder editing
- Live search
- Product filtering
- Form submissions
- Admin operations
- Dynamic content
- Plugin interfaces
If only one particular action fails while normal pages load correctly, the memory problem may be associated with that specific request.
This is another reason why simply increasing the global memory limit may not fully explain the issue.
Multisite Requires Additional Consideration
WordPress Multisite can have more complex resource requirements because multiple sites share the same WordPress installation and server environment.
A plugin activated across a network can affect multiple sites.
Resource-heavy operations performed on one site can also place additional demand on the server.
If a Multisite installation experiences memory errors, investigate the individual site, plugins, network configuration, PHP limits, and overall server resources rather than treating it exactly like a small single-site installation.
Memory Limit Is Not the Same as Server RAM
This distinction is extremely important.
Suppose your server has 8 GB of RAM.
That does not mean one PHP request can automatically use 8 GB.
PHP memory limits, PHP-FPM configuration, hosting restrictions, process limits, and other server settings determine how resources are allocated.
Likewise, increasing the PHP memory limit does not create additional physical RAM.
If too many PHP processes are allowed to consume large amounts of memory simultaneously, the server can experience resource pressure.
For example, giving every PHP process an extremely high memory limit can be dangerous on a server with limited RAM.
This is why memory limits should be considered together with the hosting environment.
When a Higher Memory Limit Is the Right Solution
Increasing the memory limit is reasonable when:
- The website is otherwise functioning normally.
- A specific legitimate operation needs more memory.
- The hosting environment has sufficient resources.
- The error disappears after increasing the limit.
- There is no evidence of abnormal memory consumption.
For example, a large WooCommerce product import or image-processing task may legitimately require more memory than a simple WordPress page.
When Increasing Memory Is Not the Right Solution
Do not keep increasing the memory limit if:
- A simple page consumes hundreds of megabytes.
- The error happens repeatedly during normal browsing.
- One plugin consistently consumes excessive resources.
- Memory usage increases continuously.
- The website crashes even after a reasonable memory limit increase.
- The server itself is running out of RAM.
- The problem started immediately after installing a plugin or theme.
- A custom PHP function contains inefficient code.
In these cases, increasing the limit may only postpone the failure.
A Practical Troubleshooting Order
If a WordPress website suddenly starts showing memory errors, follow a structured process.
1. Read the Complete Error
Do not focus only on the phrase “memory exhausted.”
Look at:
- Memory limit
- Memory consumed
- File path
- Line number
- Request that triggered the error
This information can provide valuable clues.
2. Check the Current PHP Memory Limit
Confirm what PHP is actually configured to allow.
Do not assume the value in wp-config.php is the active PHP limit.
3. Determine When the Error Happens
Ask:
- Does it happen on the frontend?
- Only in wp-admin?
- Only in Elementor?
- Only during checkout?
- Only during imports?
- Only during image processing?
- Only during backups?
- Only during scheduled tasks?
The answer significantly narrows the investigation.
4. Check Recent Changes
Think about what changed immediately before the problem appeared.
For example:
- New plugin
- Plugin update
- Theme update
- PHP version change
- WooCommerce update
- New integration
- Large import
- New custom code
Recent changes are often valuable clues.
5. Check Error Logs
Look for repeated errors around the same time.
6. Test Suspected Plugins
Use a staging environment whenever possible.
7. Increase Memory if Appropriate
If the website genuinely needs more memory and the server can support it, increase the limit.
8. Test Again
Confirm whether the problem is actually resolved.
9. Investigate the Root Cause
If the website still requires an unusually large amount of memory, investigate the code, plugin, query, or process responsible.
Example: A Website With a 128 MB Limit
Imagine a WordPress website has:
memory_limit = 128M
The administrator opens a large Elementor page and receives:
Allowed memory size exhausted
Increasing the limit to 256 MB may allow the page to load.
That can be a valid solution if the page genuinely requires more memory.
But if the same page eventually requires 512 MB, 768 MB, or more, the question changes.
At that point, you should investigate:
- Number of Elementor elements
- Third-party Elementor extensions
- Dynamic content
- Plugins
- Database queries
- Custom code
- Theme functionality
The goal is not to make the memory limit infinitely large.
The goal is to keep resource consumption reasonable for the workload.
How to Prevent WordPress Memory Limit Problems
Once the problem is fixed, take steps to reduce the chance of it returning.
Keep WordPress Updated
Keep WordPress core, plugins, and themes updated.
Updates can include bug fixes and improvements that affect resource usage.
Always test major updates before applying them to critical production websites.
Remove Unnecessary Plugins
Do not keep plugins installed simply because they might be useful someday.
Every additional component increases complexity.
Avoid Duplicate Functionality
If two plugins perform the same task, consider whether both are necessary.
For example, avoid unnecessarily running multiple systems for:
- Caching
- Security
- SEO
- Optimization
- Image processing
- Backups
Overlapping functionality can create conflicts and additional resource consumption.
Use Appropriate Hosting
A website that has outgrown shared hosting may need more server resources.
Signs can include:
- Frequent PHP resource errors
- Slow backend
- High TTFB
- CPU throttling
- Memory pressure
- PHP worker limitations
- Slow database operations
If the server itself is underpowered, changing WordPress settings alone will not solve the larger problem.
For more information about backend performance, see the guide on how to fix high TTFB in WordPress.
Optimize Large Operations
If a plugin needs to process thousands of products, images, or records, look for options such as:
- Batch processing
- Smaller imports
- Scheduled processing
- Background processing
- Reduced dataset size
Processing a large operation in smaller batches can reduce peak memory consumption.
WordPress Memory Limit Checklist
Use this checklist when troubleshooting a memory error:
- Check the complete PHP error message.
- Identify the request that caused the problem.
- Check the actual PHP
memory_limit. - Check WordPress memory settings.
- Check
WP_MEMORY_LIMIT. - Check
WP_MAX_MEMORY_LIMIT. - Review recent plugin and theme changes.
- Check PHP error logs.
- Check WordPress debug logs in a safe environment.
- Identify the plugin or theme mentioned in the error.
- Test suspected plugins carefully.
- Check Elementor if the problem occurs while editing pages.
- Check WooCommerce if the problem occurs during store operations.
- Check image processing if errors occur during uploads or thumbnail generation.
- Check backup and migration tools.
- Check scheduled tasks if the error appears periodically.
- Use Query Monitor when appropriate.
- Increase memory when the workload genuinely requires it.
- Verify that the hosting environment can support the new limit.
- Do not repeatedly increase the limit without investigating the cause.
- Test the website after making changes.
Final Thoughts
WordPress memory limit errors are often easy to recognize but not always easy to diagnose correctly.
The message may simply tell you that PHP reached its memory limit, but it does not automatically explain why that happened.
The correct approach is to separate two questions:
How much memory does this website need?
and:
Why does this particular request need that much memory?
If a legitimate operation requires more memory, increasing the PHP and WordPress memory limits can be an appropriate solution.
If a simple page suddenly consumes an unusually large amount of memory, however, increasing the limit may only hide the underlying problem.
Check the PHP configuration, WordPress settings, error logs, plugins, themes, page builders, WooCommerce operations, image processing, scheduled tasks, database operations, and custom code before deciding what needs to change.
A properly configured WordPress website should have enough memory for its actual workload without relying on an unnecessarily high limit.
Memory management is also only one part of WordPress performance. Server response time, caching, database performance, CSS, JavaScript, images, plugins, and hosting resources all contribute to the overall result.
Understanding how these components interact makes it much easier to troubleshoot WordPress problems instead of simply increasing server limits whenever something fails.
Want to Understand WordPress Beyond Page Speed?
Website performance is only one part of building a reliable WordPress website.
Once you understand how the server, WordPress core, plugins, database, caching, SEO, security, and WooCommerce work together, it’s much easier to diagnose problems and make the right optimization decisions.
The WP Flow Mastery WordPress eBook is a 160+ page practical guide covering WordPress hosting, development, website performance, SEO, security, WooCommerce, optimization, and other essential areas of professional WordPress work.
Instead of piecing together information from dozens of unrelated tutorials, you can use one structured resource to build a stronger understanding of the entire WordPress workflow.
Get the WP Flow Mastery WordPress eBook →
Written by Nemanja Stosic
WordPress Developer & Website Optimization Specialist
Nemanja has worked on more than 200 websites and focuses on WordPress development, performance optimization, SEO, security, WooCommerce, and practical website improvements.