Fix for Theme Menu Options Not Saving in WordPress

Fix for Theme Menu Options Not Saving in WordPress

After a good amount of troubleshooting and web research I’ve located a fix for theme menu options not saving in WordPress on DreamLight.com and some of our client WordPress sites.

Common Symptoms of the Problem

Some common symptoms of this problem are that you start to notice that some of your theme options or menu settings are disappearing. You change them and save them but then they are being reset to defaults after you attempt to reload them. They are typically some of the theme options or menu settings that are further down the list of options or menus. Theme options and menus near the beginning of the options or menu lists are saving and loading normally. This typically happens if you’ve exceeded some of the server’s limit settings. This may happen suddenly on a site that was working fine if there has been a recent server update, moving the site from one server to another server, updating a theme or moving a site from a local WordPress development install to an online server installation.

The Cause – A Collision of Two Worlds

The cause is generally a collision of two worlds. As WordPress web sites get more and more sophisticated, they tend to contain more and more custom options and menu items. Each of those options or menu items are often built of a number of related data fields. A single menu item may contain a dozen or so related variables. So, these lists of variables grow longer and longer rather quickly. At the same time web sites, and WordPress installations in particular, are being hacked more and more often. One hacking method used is to overload web input queries to overload the server. To combat such hacking methods newer installations of PHP (the sever programming language that WordPress is built on) default with a limit of 1000 variables in any input query, such as when you try to save theme options or menus. Any submitted variables beyond that limit will simply be ignored, and lost.

This conflict between growing data lists and reduced security defaults can lead to the loss of theme options or menu settings in sophisticated themes that have many theme options or sites that use many menu, slider or carousel items.

Verifying the Reason Theme Menu Options Not Saving in WordPress

There are a couple of easy ways to confirm the reason for theme menu options not saving in WordPress is that these limits are being exceeded. The first way is to examine your server’s PHP error log. Contact your server administrator if you can’t find it. If you see any errors similar to the following, it confirms the cause of the problem.

[13-Jul-2014 16:14:54 ] PHP Warning: Unknown: Input variables exceeded 1000.
To increase the limit change max_input_vars in php.ini.

You can easily verify your server’s variable limits by creating a simple temporary text file that contains the following line:

<?php phpinfo(); ?>

Then post that file somewhere on your site and pull it up in a web browser. Review the resulting displayed information looking for any of the following items. The suhosin variables will only be included if your server is running the suhosin extension.

max_input_vars = 1000
suhosin.post.max_vars = 1000
suhosin.request.max_vars = 1000

Delete the temporary files when done so as not to leave any potential security holes open.

Fix for Theme Menu Options Not Saving in WordPress

To increase the limit include the following in your PHP.ini file:


max_input_vars = 3000
suhosin.post.max_vars = 3000
suhosin.request.max_vars = 3000

Note. The suhosin settings are only required if your server is running the suhosin extensions.

Related Links and Research

For more information about this issue, the symptoms and the solution please refer to the following links.

The WordPress Menu Item Limit or: Help! Half my menu items just disappeared!

PHP Warning: Unknown: Input variables exceeded 1000

Custom WordPress Web Site Development

Contact Us Today for custom WordPress Web Site Development if you have an aging static HTML Web site and would like to upgrade to a new custom designed WordPress based site with a built in content management system, blog, SEO and more!

Leave a Reply