Are you seeing an allowed memory size exhausted error message in WordPress?
One of the most common WordPress issues can be quickly fixed by raising WordPress's PHP memory limit.
This article will demonstrate increasing the PHP memory limit to fix the WordPress memory exhausted error.
What Is the WordPress Memory Exhausted Error?
WordPress was created using the server-side programming language PHP. Every website also needs a WordPress hosting server to run effectively.
Web servers function similarly to other computers. To effectively operate many apps at once, they need memory. The memory size allotted by server administrators to various programs, including PHP, varies.
You will notice this warning message if your WordPress code uses more memory than the standard amount allotted:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home4/xxx/public_html/wp-includes/plugin.php on line xxx
WordPress, by default, attempts to raise the PHP memory limit if it falls below 64MB. However, more than 64MB is needed.
After that, let's look at how to quickly boost WordPress' PHP memory limit to prevent the WordPress memory exhausted error.
Increase the PHP Memory Limit in WordPress
The wp-config.php file on your WordPress website has to be edited first. Since it resides in the root folder of your WordPress website, you will need to use an FTP program or the file manager in your web hosting control panel to access it.
Next, insert this code exactly before the line that reads, "That's all, stop editing!" in the wp-config.php file.
define( 'WP_MEMORY_LIMIT', '256M' );
This code instructs WordPress to raise the PHP memory limit to 256MB.
After finishing, you must save your modifications and re-upload your wp-config.php file to the server.
As an alternative, you may enter this code fragment using WPCode. The finest WordPress code plugin allows you to add code to the files that make up your website without actually modifying them.
Now that you can access your WordPress website, the WordPress memory exhausted error will be gone.
Note: If this fix doesn't work for you, it implies that WordPress can't increase the PHP memory limit with your web hosting company. If you are utilizing shared hosting, this is typical. You must inquire if your site hosting company can manually increase the WordPress RAM limit.