The “memory exhausted” error in WordPress occurs when your site’s PHP memory limit has been reached. This can be caused by a number of factors, including poorly-written plugins, heavy traffic, or large images.
Here are some steps you can take to try to fix the error:
Increase the PHP memory limit: One of the easiest ways to fix the memory exhausted error is to increase the PHP memory limit. To do this, you can add the following line to your wp-config.php file:
This will increase the PHP memory limit to 256MB. You may need to increase the memory limit further if the error persists.
Deactivate plugins: If you have recently installed a new plugin or activated a plugin that you previously had deactivated, it is possible that the plugin is causing the memory exhausted error. Try deactivating all of your plugins and then reactivating them one by one to see if the error persists.
Optimize images: Large images can consume a lot of memory and may contribute to the memory exhausted error. Try optimizing your images by reducing their size or using a plugin like Smush to compress them.
Check your theme: If you are using a heavily customized theme, it may be using more memory than a default theme. Try switching to a default theme (such as Twenty Twenty) to see if the error persists.
Upgrade your hosting plan: If you are on a shared hosting plan and are experiencing a lot of traffic, you may need to upgrade to a plan with more memory and resources.