How to Increase the Max Input Vars Limit in WordPress

The “PHP Max Input Vars” 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 must increase the PHP max_input_vars value.

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

This error can cause 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.

How to Increase the PHP Max Input Vars Limit?

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 3 methods.

1. Edit the .htaccess File.

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

This file is usually in your host’s root directory. Open it with your file manager or FTP client.

Increase Max Input Vars in .htaccess
Increase Max Input Vars in .htaccess

It could be because most hosting providers hide the (.) files if you can’t locate it. 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 4000

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

2. Edit the PHP.ini or .user.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, 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 = 4000

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

3. Edit the wp-config.php File.

This method 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' , 4000 );

Finally, save the changes.

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

You may also like...