You see this error: Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate X bytes). WordPress tried to use more PHP memory than the server allows. The number after “Allowed memory size” shows your current limit in bytes – 67108864 is 64MB, 134217728 is 128MB, 268435456 is 256MB. The fix has two parts: raise the limit so the immediate error stops, then find what is consuming the memory so you are not just masking a problem.
Step 1: Increase the PHP Memory Limit
Try these methods in order until one works:
In wp-config.php (add above the “That’s all” line):
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );
WP_MEMORY_LIMIT is for frontend. WP_MAX_MEMORY_LIMIT is for the admin. If only admin pages are hitting the limit, the second constant is what matters.
In .htaccess:
php_value memory_limit 256M
In a php.ini file in your web root:
memory_limit = 256M
Not all hosting environments allow all methods. On managed WordPress hosting, memory limits are set at the server level – use your hosting panel or contact support to increase the limit.
Problem not solved? Describe the issue and get a free estimate.
Step 2: Verify the Limit Increased
After making the change, verify it took effect. Go to WordPress -> Tools -> Site Health -> Info -> Server. Look for “PHP memory limit” – it should show your new value. If it still shows the old limit, your hosting environment is ignoring the setting and you need to contact your host to increase the server-level PHP memory limit.
Step 3: Find What Is Using the Memory
Raising the limit stops the immediate error but does not fix the root cause. A well-optimised WordPress site uses 40-80MB for a standard page load. If you need 256MB or more, something is using too much memory. Install Query Monitor and check the Memory section on the page that was hitting the limit. It shows peak memory usage per page load.
To narrow down which plugin is the culprit, deactivate plugins one at a time and watch the memory usage in Query Monitor. The plugin that drops memory usage significantly when deactivated is the problem. Common offenders: image processing plugins that load entire images into memory, plugins that cache large data sets in PHP memory, and poorly coded plugins that do not release memory after operations.
Step 4: Common Causes and Specific Fixes
Image processing during upload: Large image uploads trigger multiple resize operations simultaneously. If the memory error appears specifically when uploading images, increase memory and also reduce the number of image sizes WordPress generates. Go to Settings -> Media and reduce the sizes, or use a plugin like Imsanity to auto-resize uploaded images to a maximum dimension before WordPress processes them.
WooCommerce with many products: WooCommerce loads product data into memory for certain operations. Admin pages showing all products simultaneously can exhaust memory on large catalogs. Enable WooCommerce’s HPOS (High Performance Order Storage) and ensure you are on WooCommerce 7.1+ where memory usage for order management was significantly reduced.
Bulk operations: Running bulk actions (bulk update 500 products, regenerate thumbnails for 2000 images) inherently uses more memory than normal page loads. These operations should run with a higher memory limit. WP-CLI (command line WordPress management) handles bulk operations more efficiently than the admin interface and bypasses web server memory limits.