Php max input vars wordpress wp-config

The PHP variable max_input_vars was introduced in PHP as a security measure to limit the maximum number of POST variables sent. It represents the number of variables your server can use to run a function.

If you get the error “Increase PHP Max Input Vars Limit” in WordPress, you need to increase the PHP max_input_vars value.

This post explains how to change the maximum allowed number of PHP script input variables for your entire web hosting account to meet specific application needs.

This error can cause very non-specific issues like losing all theme settings, or the widgets may disappear when the WordPress settings are saved. Also, other plugins may stop working or not work as expected anymore.

There are many different methods to increase PHP Max Input Vars in WordPress. However, this entirely depends on the hosting provider you are using.

Remember that you may not have specific permissions to increase the maximum PHP input variable limit. Therefore, contact your hosting provider beforehand and ask them to grant you the necessary permissions.

You can increase the PHP Max Input Vars Limit by adding lines to the .htaccess file, php.ini or wp-config.php.

Here we explain all methods.

Edit the .htaccess File

The first method to increase the Max input var limitation is editing the .htaccess file. Before you make any changes to the file, make sure you get a backup of your site or at least of this file.

Usually, this file is in the root directory of your host. Open the file with your file manager or FTP client.

Php max input vars wordpress wp-config
Increase Max Input Vars in .htaccess

If you can’t locate it, it could be because most hosting providers hide the (.) files. Therefore, look for the option Show Hidden Files in your file editor and enable it.

Open the .htaccess file in an editor and add the following code to it:

php_value max_input_vars 2000

If you are using Suhosin, add the following to the file instead:

php_value suhosin.request.max_vars 2000
php_value suhosin.post.max_vars 2000

The recommended value is 2000 for PHP input vars. If you need more, you could always increase it to match your needs.

Edit the PHP.ini file

The following method to increase the PHP max input vars limit in WordPress is editing the php.ini file.

This file is also in the root directory of your host, where you have installed WordPress.
If you can’t find it, simply create a new empty php.ini file.

In either case, open the file in an editor and add the following code to it:

max_input_vars = 2000

Don’t forget to save the changes and reboot your server once to use the newly added data.

Edit the wp-config.php File

This method also requires you to log in to your hosting panel or FTP.
Go to File Manager and look for the wp-config.php file.

Open the file in an editor and add the following code to it:

@ini_set( 'max_input_vars' , 2000 );

Finally, save the changes.

You can replace 2000 with any value you require. However, we recommend 2000 or higher.
If you use any value below 2000, it could throw the Max Input Vars error.

How to Increase the Max Input Vars Limit in PHP5?

If you use a host that still uses PHP5 like GoDaddy or Bluehost, you need to edit php5.ini and user.ini files.

So, if you are using a host that still uses PHP5, you need to create the files mentioned above in the host. After creating them, copy and paste the following code to both:

max_input_vars = 2000
suhosin.get.max_vars = 2000
suhosin.post.max_vars = 2000
suhosin.request.max_vars = 2000

Again, you can replace 2000 with the value your website needs.

Possible Server-Side Issues

If you tried each of the methods above and still get the max input vars error, you need to contact the hosting provider and ask them to fix the issue.

For instance, there could be another copy of the php.ini file in the host, and that could overwrite your local settings.

This article explained every possible method to increase the PHP max input vars limit in WordPress. Follow the steps above only if only you are familiar with working with server files. Otherwise, contact your hosting provider and ask them to help you or get in contact with our support team.

How to Increase the Max Input Vars Limit

Instructions on How to Increase the Max Input Vars Limit

Info

PHP Max Input Vars is the maximum number of variables your server can use for a single function to avoid overloads.

The max_input_vars directive can be set in .htaccess, php.ini , .user.ini or wp-config.php file. To gain access to these files you will need FTP credentials. If you do not have these please contact your hosting provider.

  1. In your WordPress root installation locate any of these .htaccess, php.ini, .user.ini or wp-config.php
  2. Edit the file and paste the directive code
  3. Once you are done making changes save the file. If you have downloaded the file to make this change, upload it back to your server and override the existing file.

Directive for .htaccess

php_value max_input_vars 4000

Directive for php.ini or .user.ini

max_input_vars =4000

Directive for wp-config.php

@ini_set( 'max_input_vars' , 4000 );

The minimum recommended limit is 4000

Warning

Changing server directives is recommended to site owners who are confident to do so. If you rather have professionals do this for you, contact your hosting provider.

We use cookies to maintain login sessions, and to improve your experience on our website. By continuing to use our site, you accept our use of cookies, Privacy Policy and Terms of Service.

How do I increase PHP max input vars in WordPress?

Max Input Vars can easily get increased by using a line of code. PHP max input vars is simply the number of variables your server is set to handle in each function. If you receive the error 'Increase PHP Max Input Vars Limit' in WordPress, you need to add the code 'php_value max_input_vars 3000' to your .

How do I change the input vars limit in WordPress?

How to Increase the Max Input Vars Limit.
In your WordPress root installation locate any of these .htaccess , php.ini , .user.ini or wp-config.php..
Edit the file and paste the directive code..
Once you are done making changes save the file..

What is PHP max input vars?

By default, the maximum number of input variables allowed for PHP scripts is set to 1000. You can change this amount by setting the max_input_vars directive in a php. ini file.

How do you increase PHP max time limit and max input variables?

1 Method: edit the PHP..
Locate your PHP. ini file. ... .
If you find your existing PHP. ini, open the file and locate the following line of code (xx represents a number): max_input_vars = xx ; And set it to your desired limit. ... .
If you created your own PHP. ... .
Save your changes, and reboot your local host or your server..