How to increase memory limit in WordPress

Are you looking for a way to increase the built-in memory limit in WordPress? Well here is the small snippet which can be used to increase the limit.

Edit your wp-config.php file
Add the following to the wp-config.php file.
Above the line that says /* That’s all, stop editing! Happy blogging. */
// increase the PHP memory limit in WordPress

define('WP_MEMORY_LIMIT', '256M');
define( 'WP_MAX_MEMORY_LIMIT', '256M' );

/* That's all, stop editing! Happy blogging. */


Edit your PHP.ini file
If you have access to the PHP.ini, then you’ll likely find the file in the root folder the location of the file will vary according to your host.
Add the following to the PHP.ini file.

// increase the PHP memory limit in WordPress

memory_limit = 256M
upload_max_filesize = 12M
post_max_size = 13M

Edit your .htaccess file
If you don’t have access to the PHP.ini file, this is your last move to increase the memory limit. If you don’t see the file in the root folder then make sure to check in the SFTP file.
Add the following to the .htaccess file.
// increase the PHP memory limit in WordPress

php_value memory_limit 256M
php_value upload_max_filesize 12M
php_value post_max_size 13M

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top