How to increase wp memory limit and PHP Max Input Vars in wordpress

Increasing memory allocated to PHP:

 

Just add this line into wp-config.php file:

1
define( 'WP_MEMORY_LIMIT', '64M' );

Add this code into htaccess file:

1
php_value memory_limit 128M

max_input_vars

The most common issue stems from the

1
max_input_vars

PHP directive, which was introduced in PHP 5.3.9. By default, max_input_vars is set to 1000, which can easily be reached with the WordPress menu system, since each menu item sends about 12 variables per item.

Solution

The solution is to simply configure the

1
max_input_vars

so that it is large enough to handle the number of variables being sent by WordPress to save your menu.

php.ini

If you have access to your

1
php.ini

, you can just add this directive (or change the value of the existing directive) to includes your max input variables:

1
max_input_vars = 3000;

If you don’t have access to this file (as with many shared hosts), you may need to contact your host to increase this limit.

.htaccess

Alternatively, you can try placing this in your

1
.htaccess

. This won’t work on some servers, so your mileage may vary.

1
php_value max_input_vars 3000

Leave a Reply