Unfortunately when I try to login one of my WordPress website, there is an error inside the wp-admin page Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 56383 bytes) in /custom.php on line 125. Or you may found similar error most of times, Don’t worry all are WordPress Memory Limit error.
WordPress Memory Limit & Max Memory Limit
First open your root directory of WordPress and find for “wp-config.php“ file and open file in your editor. Then add the following lines inside the main php tag:
define( 'WP_MAX_MEMORY_LIMIT' , '512M' );
We increased the memory limit to 256MB and Maximum memory limit to 512MB.
If you don’t want to change your wp-config.php file then you can choose second option also.
For that you need to update your php.ini file which is also located in root directory of WordPress (If not exist then simply create php.ini file using FTP).
Now add the following line of code within your php.ini file.
memory_limit = 256M
These both would increase the memory limit to 256 MB.
If you still get the error after this solutions, then please contact your hosting provider.
Note : If you have other solutions for increasing the memory limit, then let us know in the comments below.