If you’ve ever encountered issues with forms, theme options, or plugin settings not saving correctly in WordPress, the problem might be related to the PHP max_input_vars setting. This setting limits the number of input variables your server can process in a single request. When this limit is exceeded, data can be truncated, leading to incomplete form submissions or settings not being saved.
In this guide, we’ll walk you through four effective ways to increase the max_input_vars limit in WordPress. Whether you’re a beginner or an advanced user, these methods will help you resolve the issue quickly.
What is max_input_vars?
The max_input_vars is a PHP directive that controls the maximum number of input variables (like form fields, checkboxes, or dropdowns) your server can process in a single request. The default value is usually 1000, but for complex WordPress sites with large forms or advanced theme options, this limit can be easily exceeded.
Symptoms of max_input_vars Limit Being Reached
- Forms not saving all submitted data.
- Theme customizer or plugin settings not updating.
- Error messages related to input variables.
- Large menus or widgets not saving correctly.
Video Tutorial: How to Increase max_input_vars in WordPress
Watch this helpful video tutorial that demonstrates how to increase the max_input_vars limit:
4 Ways to Increase max_input_vars in WordPress
1. Edit the php.ini File
If you have access to your server’s php.ini file, this is the most straightforward method:
- Locate the php.ini file in your server’s root directory.
- Open the file and find the line that says max_input_vars.
- If the line doesn’t exist, add it:
max_input_vars = 3000
. - Save the file and restart your server.
Note: If you’re unsure where the php.ini file is located, contact your hosting provider for assistance.
2. Modify the .htaccess File (For Apache Servers)
If you’re using an Apache server, you can increase the max_input_vars limit by editing the .htaccess file:
- Access your website’s root directory via FTP or your hosting control panel.
- Locate the .htaccess file and open it.
- Add the following line:
php_value max_input_vars 3000
. - Save the file and clear your browser cache.
For more information on editing .htaccess files, check out this beginner’s guide to .htaccess.
3. Add Code to wp-config.php
Another way to increase the limit is by adding a custom PHP directive to your WordPress wp-config.php file:
- Access your website’s root directory via FTP or your hosting control panel.
- Locate the wp-config.php file and open it.
- Add the following line before the
/* That's all, stop editing! Happy blogging. */
comment:ini_set('max_input_vars', 3000);
. - Save the file and test your forms or settings.
Learn more about editing wp-config.php in the WordPress Codex.
4. Contact Your Hosting Provider
If you’re on shared hosting and don’t have access to server files, you can contact your hosting provider and request them to increase the max_input_vars limit for your account. Most hosting providers are familiar with this issue and can make the change for you.
Recommended Value for max_input_vars
For most WordPress sites, increasing the limit to 3000 is sufficient. However, if your site has extremely complex forms or settings, you may need to set it higher. Be cautious not to set it too high, as this can impact server performance.
For more technical details, refer to the PHP Official Documentation on max_input_vars.
Testing After Making Changes
After increasing the max_input_vars limit, test your forms, theme options, and plugin settings to ensure everything is working correctly. You can also use tools like WordPress performance optimization tools to monitor your site’s performance.
Best Practices
- Regularly optimize your forms and settings to reduce the number of input variables.
- Use plugins like top WordPress form plugins to manage complex forms efficiently.
- Always back up your site before making server-side changes.
Conclusion
Increasing the max_input_vars limit is a simple yet effective solution for resolving form submission issues in WordPress. By following one of the four methods outlined above, you can ensure your site functions smoothly and avoids data truncation problems. If you’re unsure about making these changes, don’t hesitate to reach out to your hosting provider for assistance.
For more WordPress tips and tutorials, check out our guide on common WordPress errors and how to fix them.
Frequently Asked Questions
What happens if max_input_vars is too low?
If the max_input_vars value is set too low, WordPress may truncate form data during submission, resulting in incomplete saves, missing settings, or form submission failures.
Is it safe to increase max_input_vars?
Yes, it’s generally safe to increase the max_input_vars value to a reasonable number like 3000-5000. However, setting it extremely high might impact server performance.
How do I know if max_input_vars is causing my issue?
If you’re experiencing problems with complex forms not saving completely, theme options not updating, or large menus disappearing after saving, these are strong indicators that your max_input_vars limit needs to be increased.
Do I need to restart my server after changing max_input_vars?
It depends on the method used. When editing php.ini directly, a server restart is typically required. For .htaccess or wp-config.php methods, a restart is usually not necessary.