Custom fields help customers enter data easily. They are used a lot in WordPress, especially for non-blog websites. Custom fields provide a convenient way to store data for not only logical processing (such as product price), but also for presentation purposes.
However, there is a problem when using too many custom fields for a post – the custom fields might not be saved properly. For example, you use custom fields to create a landing page, which has multiple sections and each section has a lot of customization options. Then the number of custom fields is very large, up to thousands. And when you update the post, you might see some fields are not saved.
This is a fairly common problem. That’s not an error. No errors are saved. That’s just how PHP works with the
The PHP Max Input Vars is the maximum number of variables your server can use for a single function. To work properly with a modern WordPress theme set this value to 3000. If the value is too low, you may experience problems such as lost data within your Theme Options and custom fields.
If you find that your custom fields are not saved when submitted, this is likely to be the cause. In this case, you have to increase the value of
How to Increase
Most shared hosts won’t grant you full access to modify this value. Please contact your host first to find out if they can adjust it for you. This is a simple setting they can change without problems (they tend to keep it low by default to save their resources).
For advanced users who have their own server setups and full access to the PHP.ini file, please go ahead and try Method 1 first before the other method. For standard users, we encourage you to try following Methods.
max_input_vars Value in
The next method to increase the PHP max input vars limit in WordPress is through 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 php.ini file.
In either case, open the file in an editor and add the following code to it:
max_input_vars = 3000
Don’t forget to save the changes and reboot your server once, to use the newly added data.
max_input_vars Value by
increase Max input var limitation is by editing the .htaccess file. Before you make any changes to the file, make sure you get a backup of it.
Usually, this file is in the root directory of your host. If you can’t locate it, it could be because most hosting providers hide the (.) files. Therefore, look for the Show Hidden Files option in your configuration and enable it.
Open the .htaccess file in an editor and add the following code to it:
php_value max_input_vars 3000
or if you are using Suhosin, add the following to the file:
php_value suhosin.request.max_vars 3000 php_value suhosin.post.max_vars 3000
The recommended value is 3000 for PHP input vars. In case you need more; you could always increase it to match your needs.
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' , 3000 );
Finally, save the changes.
You can replace 3000 with any value you require. However, we recommend 3000 or above, if you use any value below 3000, it could cause the Max Input Vars error.
Not only the number of custom fields affected by
max_input_vars, but all the activities related to the form, submit are also affected. So, if you use a form plugin, avoid creating too long forms. It is not only good for user experience but also avoiding potential problems with
There is also another part of WordPress that is affected by
max_input_vars – the menu. If you create a menu with too many items, then it is possible that the number of inputs will exceed the value of
max_input_vars. Note that for each menu item, WordPress has a lot of inputs, such as title, description, class and relation. So, keep the number of menu items small.
Reduce the number of custom fields to make your edit screen cleaner. In case the number of your custom fields is too large, use the methods above to increase the value of
max_input_vars to ensure they are saved properly. And also don’t forget the forms or menus in WordPress!