The “Allowed memory size of X bytes exhausted” error is a common WordPress problem that appears when your site needs more memory than PHP allows. Here’s how to fix it.
What Causes the Memory Exhausted Error?
The error occurs when a plugin, theme, or PHP script uses more memory than the WordPress PHP memory limit allows. Common triggers include:
- Too many plugins running
- A poorly coded plugin or theme
- Large media library operations
- A plugin conflict
- Low default PHP memory limit
Fix 1: Increase the WordPress Memory Limit
Add this line to wp-config.php just before the “That’s all, stop editing” line:
- define( ‘WP_MEMORY_LIMIT’, ‘256M’ );
Fix 2: Increase PHP Memory in php.ini
If the wp-config.php change isn’t enough, edit php.ini and set: memory_limit = 256M. If you’re on shared hosting, use cPanel to change the PHP memory limit.
Fix 3: Increase Memory via .htaccess
On Apache servers, add this to .htaccess: php_value memory_limit 256M.
Fix 4: Identify the Problem Plugin
If the error mentions a specific plugin or theme file, that plugin is the culprit. Deactivate it or contact its developer.
Fix 5: Optimize Your Site
Reduce memory usage by removing unused plugins, cleaning your database, and optimizing images.
Still Getting Memory Errors?
Contact Finggu Infotech for professional WordPress optimization and error fixing.
