WordPress保存菜单丢失限制

主页 \ 新手指南 \ WordPress保存菜单丢失限制

max_input_vars

The most common issue stems from the max_input_vars PHP directive, which was introduced in PHP 5.3.9. By default, max_input_vars is set to 1000, which can easily be reached with the WordPress menu system, since each menu item sends about 12 variables per item.

解决方法:

The solution is to simply configure the max_input_vars so that it is large enough to handle the number of variables being sent by WordPress to save your menu.

php.ini

If you have access to your php.ini, you can just add this directive (or change the value of the existing directive) to includes your max input variables:

max_input_vars = 3000;

If you don’t have access to this file (as with many shared hosts), you may need to contact your host to increase this limit.

.htaccess

Alternatively, you can try placing this in your .htaccess. This won’t work on some servers, so your mileage may vary.

php_value max_input_vars 3000

.user.ini

If you have a .user.ini file, you can add the following to override the default php.ini value

max_input_vars = 5000;

Suhosin

This issue is less common, nowadays, but the issue can also occur due to a program called Suhosin which runs on your server. This is a known issue with WordPress, and affects both the standard WordPress Menu System, as well as UberMenu, which is built on top of that system.

In most cases, the solution is as simple as asking your host to increase the max_vars variables in your php.ini.

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

If you don’t have access to php.ini

If you’re on shared hosting, you may not have access to the php.ini. In most cases, it is best to contact your host to have them change these values if you are not able to do so yourself. However, on some hosts you can adjust these values in files that you have access to. If these solutions do not work and you do not have access to your php.ini, you’ll need to contact your host to make the changes.

In some cases, hosts have refused to make this change. I suggest sending them the trac ticket and this very detailed article. If that does not convince them that they should increase this limit, as they are artificially restricting the capabilities of their WordPress customers, it’s probably time to think about changing to a better host. Unfortunately, if they won’t let you increase this limit, there’s nothing left to be done to solve this issue – you might try the workaround below.

A Workaround

If for some reason you can’t increase your variable limit, you can use this workaround. Break your menu down into smaller parts and combine them via the Menu Segment functionality in UberMenu 3. As long as each segment stays below the limit, your menu should be able to function.

http://sevenspark.com/docs/ubermenu-3/faqs/menu-item-limit

ABOUT THE AUTHOR: ThemeBest ThemeBest-专为具有超前审美的个人和企业提供高端大气简约时尚的网站模板,网站开发及一站式网站建设服务。

相关文章

大神,别默默的看了,快来点评一下吧!:)