How to Increase PHP Max Input Vars Limit in WordPress

Discover easy methods to increase PHP max input vars limit in WordPress. Follow step-by-step instructions to fix menu saving issues and enhance your website’s performance.

When working with WordPress, especially themes or plugins with extensive settings, you might encounter issues due to the default PHP limit known as max_input_vars. Increasing this limit can solve problems related to saving extensive menu items or plugin options.

This guide explains clearly and professionally how to safely increase the PHP max_input_vars limit in WordPress.

What is PHP Max Input Vars?

max_input_vars defines the maximum number of variables PHP can handle in a single request. The default value is typically set to 1000. If your site requires managing extensive menus or settings, you might surpass this limit, causing your changes not to save properly.

How to Check PHP Max Input Vars in WordPress

Before modifying this setting, you should first check the current limit:

  1. Navigate to: WordPress Dashboard → Tools → Site Health → Info → Server.
  2. Find the PHP Max Input Vars: Look under "PHP" details.

Alternatively, you can create a simple PHP file to check the setting:

<?php phpinfo(); ?>

Upload this file to your site's root directory, and access it via your browser (yoursite.com/info.php).

Methods to Increase PHP Max Input Vars in WordPress

Method 1: Using .htaccess File

The .htaccess file controls various server configurations. To increase the PHP Max Input Vars limit, follow these steps:

  1. Locate and edit .htaccess: Using an FTP client or File Manager, edit the file located in your root WordPress directory.
  2. Add the following line at the end:
php_value max_input_vars 3000
  1. Save changes and verify if the limit increased using the PHP info method described earlier.

Method 2: Editing the php.ini File

If you have access to your hosting’s php.ini file, you can directly edit this file:

  1. Locate php.ini in your server's root directory.
  2. Open the file and add the following line:
max_input_vars = 3000
  1. Save and close the file.
  2. Restart your web server or wait a few minutes for changes to take effect.

Method 3: Using wp-config.php

In some hosting environments, you can adjust PHP settings via wp-config.php. Follow these simple steps:

  1. Open your wp-config.php file.
  2. Add this line near the top of the file:
@ini_set('max_input_vars', 3000);
  1. Save the file and check the setting again.

While the ideal limit depends on your site requirements, a common recommended value is between 3000 to 5000 for most complex WordPress sites.

Common Issues When Changing Max Input Vars

  • Changes Not Taking Effect: Ensure no conflicting settings are overriding your changes, especially in managed hosting environments.
  • Internal Server Errors (500): If you experience this, revert changes and contact your hosting provider for assistance.

Verify the New PHP Max Input Vars Limit

Always verify if your new setting is active:

  • Navigate again to WordPress Dashboard → Tools → Site Health → Info → Server.
  • Or use the previously mentioned PHP info file method.

Conclusion

Increasing the PHP max_input_vars limit is essential for managing large menus or complex plugin settings in WordPress. Ensure you choose the correct method according to your hosting environment, and always double-check your changes.

By properly configuring this PHP limit, you enhance your site's functionality, avoiding potential issues that might disrupt your workflow.


Optimized keywords: PHP max input vars, increase max input vars WordPress, WordPress PHP settings, max_input_vars limit, WordPress troubleshooting.

Last updated on