You may have encountered a common problem with WordPress where the menu list doesn’t save changes. This can be frustrating, especially if you’re trying to update your site’s navigation or add new pages to the menu, only to find that it doesn’t save the items. Sometimes there’s an error message, bu oftentimes the save operation will just silently fail. Fortunately, there are several troubleshooting steps you can take to fix this issue.
In this blog post, we’ll walk you through some steps to troubleshoot and fix the problem if the WordPress menu list (under Appearance > Menus) is not saving changes.
First, Clear your Browser Cache
For good measure, before we begin troubleshooting, we suggest clearing your browser cache. This will ensure that you’re not dealing with an outdated or cached version of your site.
Try Increasing the PHP Memory Limit
It’s possible that your site is reaching its PHP memory limit when trying to save a large list of menu items. To increase your PHP memory limit, you need to access your site’s wp-config.php file and add the following line of code:
Note that some hosts don’t allow this setting to be changed in code; you’ll have to confirm with your host whether it’s possibly to set the memory limit this high. On some hosting platforms, the memory limit is controlled by a setting in the hosting dashboard/control panel
Increase PHP max_input_vars
A large list of menu items can also sometimes trigger “max_input_vars” to be reached. This setting controls how many <input> tags are allowed to be passed to the backend at one time. If trying to save the menu page just fails silently, this is likely the culprit
How to change max_input_vars
- Locate your PHP.ini file: The PHP.ini file is the configuration file for PHP, and it contains various settings that can be adjusted. You will need to find the PHP.ini file that is being used by your server. You can use the phpinfo() function to check the location of the PHP.ini file.
- Open the PHP.ini file: Once you have located the PHP.ini file, you can open it using a text editor.
- Find the max_input_vars directive: You can use the search function of your text editor to find the max_input_vars directive in the PHP.ini file.
- Set the max_input_vars directive: Once you have located the max_input_vars directive, you can set it to the desired value. For example, to set the max_input_vars directive to 5000, you would add the following line to the PHP.ini file: max_input_vars = 5000
- Save the changes: After you have made the necessary changes to the PHP.ini file, save the file and restart your web server for the changes to take effect.
You can try adding the following to wp-config.php, though some hosts limit the ability to change this setting in code:
To set the max_input_vars directive in your PHP code, you can use the ini_set() function. Here’s an example of how to set the max_input_vars directive to 5000 in PHP:
To set the max_input_vars directive in your .htaccess file, you can use the php_value directive. Here’s an example of how to set the max_input_vars directive to 5000 in .htaccess:
php_value max_input_vars 5000
You can place this code in the .htaccess file in the root directory of your website. Note that this method will affect all PHP scripts on your website and will override any values set in the PHP.ini file.
It’s important to note that not all web hosts allow the use of the php_value directive in .htaccess files. If this method doesn’t work for you, you should contact your web host or use the PHP.ini file to set the max_input_vars directive.
Use the Menu Manager Ultra Plugin
Our Menu Manage Ultra WordPress menu management plugin was designed for the case where you need a better, more scalable interface for updating and managing WordPress menus. You can read more about the plugin here: Menu Manager Ultra