How to fix "out of memory" error in wordpress?

by darrion.kuhn , in category: PHP CMS , 6 months ago

How to fix "out of memory" error in wordpress?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer


by lew , 6 months ago


There are several things you can do to fix the "out of memory" error in WordPress:

  1. Increase PHP memory limit: Open your WordPress root folder and locate the wp-config.php file. Add the following line of code before the line that says "That's all, stop editing! Happy blogging.":
define('WP_MEMORY_LIMIT', '256M');

You can replace '256M' with a higher value if needed. Save the file and check if the error is resolved.

  1. Disable plugins: In some cases, a faulty or resource-intensive plugin can cause memory issues. Disable all plugins by renaming the "plugins" folder in the wp-content directory to something else. Then check if the error is resolved. If it is, enable your plugins one by one to identify the problematic plugin.
  2. Switch to a default theme: Similar to plugins, themes can also consume a lot of memory. Switch to a default WordPress theme like Twenty Twenty-One and see if the error is resolved. If it is, your original theme may be the problem. Consider upgrading to a more optimized theme or contacting the theme developer for assistance.
  3. Optimize your website: Optimize your website by reducing the number of unnecessary plugins and themes, optimizing your WordPress database, and optimizing images. This can help reduce the memory usage and resolve the error.
  4. Upgrade your hosting plan: If you have tried the above steps and still encounter the out of memory error, you may need to upgrade your hosting plan to one that provides more memory resources. Contact your hosting provider to discuss your options.

If none of the above solutions work, or if you are uncomfortable making these changes yourself, it is recommended to seek assistance from a WordPress developer or a technical support team.