Fix allowed memory size error in WordPress
In this quick tutorial, I’ll show you how to fix the allowed memory size error in WordPress.
Yesterday, while running a plugin on my WordPress client’s site, it crashed with the following error:
Error: (1) Allowed memory size of 134217728 bytes exhausted
I managed to solve it by editing the site’s wp-config.php
file and increasing the PHP memory limit.
You can watch the full walkthrough in the following video.
How to fix allowed memory size error in WordPress
In the video, I demonstrate the process using the DreamHost platform. However, the steps are generally applicable across hosting providers. Here’s what you need to do:
- Access your website files via FTP
Use an FTP client like FileZilla to connect to your site. - Edit the
wp-config.php
file
Add the following lines to the file:define('WP_MEMORY_LIMIT', '512M'); define('WP_MAX_MEMORY_LIMIT', '512M');
Important: Ensure this code is added before the
wp-settings.php
inclusion line, as recommended in DreamHost’s documentation.
A quick note
Initially, I increased the memory limit to 300M
, which resolved the error. However, I contacted DreamHost support to confirm that setting it to 512M
would comply with their policies. Their response? It’s completely fine for my hosting plan!
DreamHost support was incredibly helpful, and their guidance ensured the issue was fixed properly.
That’s it! This simple change should resolve the “allowed memory size” error on your WordPress site. Let me know if you found this tutorial helpful.