5

I'm running WP 3.4.2 on a VPS. When I first moved to this VPS server and imported all my WP data from the old, the menus worked fine. However, for some reason, I cannot edit/add to the menus, and some items have been deleted. No matter how many times I try to re-add those items, they won't appear. WP does not report any errors. When I add them again, and click the "Save Menu" button, after a long pause (30-45 sec) WP simply says, "The Main Menu menu has been updated." But the new items are missing, both from the site menus and from the WP menus setup.

Originally when I first moved to this VPS there were 9 menu top-level items, and about 90 submenu items -- about 100 menu items total. Everything displayed correctly.

Now I am limited to 88 menu items. I can only add a menu item by deleting another.

I'm not sure when this problem started, because we don't edit the menu often. It was noticed for the first time yesterday that some menu items had disappeared, which may coincide with someone adding or editing a menu item. But we've been running on this new VPS for about a month.

I found in another forum discussion a reference to suhosin which can cause menu limit problems in WP 3.x, but that is not part of our PHP installation.

I've tried Safari and Firefox (OS X). Same results with both.

2
  • Are you sure that "for some reason" is not a new plugin or some update? Have you fully troubleshooted? What about debug information?
    – brasofilo
    Dec 13, 2012 at 2:34
  • Turns out it was max_input_vars that needed to be increased in php.ini. We had updated plugins, but not installed any new ones, and none of the plugins are directly menu-related. Those are helpful links, however.
    – Michael
    Dec 13, 2012 at 15:53

4 Answers 4

5

I had a similar issue with a client's server, and the solution in their case was to increase the php max_input_vars setting in php.ini.

The number of menu items times the number of attributes for each item was exhausting the allowed input vars, so the server was silently truncating the request, resulting in menu items simply falling off the end.

1
  • This was the ticket. Adding max_input_vars = 2000 to my php.ini and restarting the server allowed me to add the truncated menu items. (Oddly, I occasionally get 404 errors when updating the menu. That is, the update loops back to the same WP page /wp-admin/nav-menus.php, but it gives a 404 error instead of displaying the menu edit page. But despite that, the menu was updated correctly.)
    – Michael
    Dec 13, 2012 at 14:44
1

This same issue was the topic of a recent article by WPBeginner


You need to edit your php.ini file. As you're hosted on a VPS, you should have access to this. Otherwise, nicely ask your webhost to do it for you.

suhosin.post.max_vars = 5000
suhosin.request.max_vars = 5000

There is also a trac ticket (#14134) that highlights this problem.

2
  • As explained in the original question, my site doesn't use suhosin. However, there is a related PHP setting, max_input_vars, which had to be adjusted. See comment from @Milo above.
    – Michael
    Dec 13, 2012 at 15:55
  • Sorry, I must of missed that bit. I'll leave my answer here just in case a passing visitor does use suhostin
    – shea
    Dec 13, 2012 at 20:19
0

I have ran into this problem on several occasions. Try this quick solution:

  1. Open your favorite text editor (Notepad, Dreamweaver, etc.)
  2. Create a file named "php.ini"
  3. Paste the following code: php_value max_input_vars 7000
  4. Save the file
  5. Upload the file to your site's root folder via ftp (Filezilla, Rush FTP, etc.)

:) That's it!

2
  • Can you please define which is the "root folder"? Is it in my \sitename\ folder?
    – p.a.
    Feb 18, 2014 at 13:58
  • @p.a.you should put the php.ini in the wp-admin folder Apr 29, 2015 at 14:29
0

Some solutions:

1) Simply change menus not from ADMIN dashboard, but from "customizer" (because it uses AJAX call)

2) Try to add php_value max_input_vars 7000 in .htaccess file (or php.ini) [when you are on shared hosting]

3) try to increase memory, add this in wp-config.php : define("WP_MEMORY_LIMIT", "128M");

Not the answer you're looking for? Browse other questions tagged or ask your own question.