Fixing WordPress menu not saving issue

Fixing WordPress menu not saving issue
3.7/5 - (3 votes)

When entering the Menus section in the WordPress dashboard, if you encounter an issue where menus are not being saved after arranging the menus, this article from the WordPress tutorials series will assist you in identifying the cause of this error. Ultimately, it will guide you in resolving the problem of menus not being saved in WordPress.

In the past, one of our clients who was using our WordPress website design services and WordPress support services faced an issue with the menus not being saved on their website. After conducting some investigations, we discovered that to resolve the problem of menus not being saved in WordPress, the ‘max_input_vars’ value needed to be increased.

Understanding Max Input Vars and Its Relation to WordPress

Fixing WordPress menu not saving

“max_input_vars” is related to server PHP settings, and the value of Max Input Vars indicates the number of variables that your site server can use for a function.
A low value for max_input_vars can often disrupt the functionality of WordPress, plugins, and WordPress themes. Therefore, if you encounter an issue with menus not being saved in WordPress, it is sufficient to increase the value of max_input_vars using the methods outlined below.

How Much Should Max Input Vars Be for WordPress?

In order to proceed with increasing the Max Input Vars for WordPress, you first need to determine the appropriate value to set for max_input_vars. The recommended value for WordPress typically falls between 3000 and 10000. However, you can start by testing with a range of 2000 to 3000 to see if it resolves the issue of menus not being saved. In many cases, setting max_input_vars to 3000 completely resolves the problem of saving WordPress menus.

Increasing the Max Input Vars through Server PHP Settings

To adjust the Max Input Vars through your server’s PHP settings, follow these steps:

  1. Locate the php.ini File: Find and access the php.ini file on your server. This file is often located in the root directory or within the ‘etc’ folder.
  2. Edit php.ini: Open the php.ini file using a text editor of your choice.
  3. Find max_input_vars: Search for the line that includes “max_input_vars”
  4. Adjust the Value: Change the value of max_input_vars to your preferred amount.
  5. Save and Close: Save the changes to the php.ini file and close the editor.
  6. Restart the Web Server: For the changes to take effect, restart your web server. This can typically be done using commands like “service apache2 restart” or “service nginx restart” depending on your server setup.

After completing these steps, the Max Input Vars value should be increased, potentially resolving issues related to saving menus in WordPress. Keep in mind that you may need sufficient server permissions to modify the php.ini file, and it’s recommended to make a backup before making any changes.

For DirectAdmin Hosting: If you are using DirectAdmin, you can adjust the Max Input Vars by following these steps:

  1. Log in to DirectAdmin’s Account Manager.
  2. Navigate to “PHP Settings” under the “Account Manager” menu.
  3. Scroll down to the bottom of the page, and in the “Add New Override” section, set the value for “max_input_vars” as needed.

This method allows you to configure the Max Input Vars directly through the hosting control panel, providing a user-friendly way to make adjustments without manually editing the php.ini file. After making the changes, ensure to save the settings. It’s always a good practice to check whether the modifications have taken effect by testing the behavior that required the adjustment, such as saving menus in WordPress.”

Increasing the Max Input Vars in the wp-config.php File

To raise the Max Input Vars through the wp-config.php file, follow these steps:

  1. Access your WordPress site’s root directory.
  2. Locate the wp-config.php file and open it using a text editor.
  3. Add the following line of code to the file, preferably just before the ‘/* That’s all, stop editing! */’ comment: define('max_input_vars', 3000);
  4. Save the changes to the wp-config.php file.

By adding this line to the wp-config.php file, you can directly override the Max Input Vars setting for your WordPress site. This approach offers a convenient alternative, especially if you prefer not to modify server-wide PHP settings or if direct server access is limited. Remember to test the site’s functionality afterward to ensure the desired changes take effect.

Increasing the Limit of max_input_vars in the .htaccess File

To enhance the limit of max_input_vars through the .htaccess file, follow these steps:

  1. Navigate to your WordPress site’s root directory.
  2. Locate the .htaccess file and open it using a text editor.
  3. Add the following lines of code to the file: php_value max_input_vars 3000
  4. Save the changes to the .htaccess file.

By incorporating these lines into the .htaccess file, you can effectively raise the limit of max_input_vars for your WordPress site. This method is particularly useful when direct server access is limited, and it provides a localized configuration for your site. Ensure to test your site’s functionality after making these adjustments to confirm the changes have been applied successfully.

Conclusion

Keep in mind that implementing any of the mentioned methods is sufficient, and there is no need to use multiple approaches simultaneously.

Additionally, your hosting provider may have imposed restrictions on server settings that could ultimately render the two methods mentioned above ineffective. Therefore, it is advisable to request your server administrator to increase the Max Input Vars to address the problem of menus not being saved in WordPress.

If you lack extensive knowledge of coding and WordPress files, it’s better to refrain from making changes to WordPress files yourself to prevent potential issues. Instead, seek assistance from a WordPress developer to ensure that adjustments are made correctly and to avoid any unintended consequences.

Do you have a question about this post?
Mahdi KHaksar
Mahdi KHaksar

WordPress expert and author of this article

I have been working in the field of WordPress for many years and now, as a member of the NikanWP family, I try to provide useful and useful tutorials to those who are interested in this field.