How to increase wp memory limit

Asked by: jenniryan
Viewed: 306
Answers: 1
  • 0

I have a theme and I get this warning that i have to increase the WP Memory Limit. I’ve heard php memory limit but not wp memory limit. How do i increase it?


Answer by: ChristianKovats

Answered on: 21 Jul 2023

  • 0


You need to edit your wp-config.php file. Open it in a text editor (not MS word) or notepad and add the following constant under WP_DEBUG:

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

WP_MEMORY_LIMIT is a configuration setting specific to WordPress, a popular content management system. It is a constant you can define in the wp-config.php file in the root directory of your WordPress installation.

WP_MEMORY_LIMIT sets the maximum amount of memory that WordPress is allowed to consume. This can be crucial when your WordPress site needs more memory for plugins, themes, or other operations.

However, it's important to note that the WP_MEMORY_LIMIT value cannot exceed the memory limit set in your PHP configuration (php.ini), also known as memory_limit. The memory_limit is the maximum amount of memory a single PHP script is allowed to allocate. This limit applies to all PHP applications running on your server, not just WordPress.

In simple terms:

WP_MEMORY_LIMIT is how much memory WordPress is allowed to use.
php memory_limit is how much memory a PHP script is allowed to use.
If you want to increase WP_MEMORY_LIMIT, you need to make sure your PHP memory_limit is equal to or higher than your desired WP_MEMORY_LIMIT.

For example, if you have a memory_limit of 128M in PHP and you set WP_MEMORY_LIMIT to 256M, WordPress will still only be able to use up to 128M.

And here's how you could set memory_limit in php.ini:

memory_limit = 256M


Please log in to post an answer!