Menu Items Disappearing

时间:2013-04-20 作者:Herr

我正在运行WP 3.5.1,我有一个包含大约100个项目的菜单。当我向菜单中添加新项目时,旧项目会消失。

我不是在经营苏霍辛或类似的东西。原因可能是什么?

注意:我在专用服务器上。

1 个回复
最合适的回答,由SO网友:birgire 整理而成

以下内容适用于一些有类似问题的用户:

尝试增加max_input_vars 变量输入php.ini. PHP版本中引入了此变量5.3.9 默认值为1000.

您可以在PHP文档中了解更多信息:

add零三e> 可以接受多少输入变量(限制分别应用于$\\u GET、$\\u POST和$\\u COOKIE superglobal)。使用此指令可以降低使用哈希冲突的拒绝服务攻击的可能性。

您可以尝试将其增加到15002000.

估计值:

使用下面的数据,我们可以尝试估计在给定一定数量的菜单项的情况下,当我们按下Save Menu 按钮

save

似乎是:

"number of POST variables" = 11 * "number of menu items" + 9
相当于线路:

y=11x+9
然后我们可以构建下表:

table

在你的情况下,如果你需要保存100 菜单项,您需要发送1109 发布变量max_input_vars 必须至少为1109.

类似地,当我们将项目添加到菜单时(通过Ajax POST)

add

我们得到

"number of POST variables" = 10 * "number of menu items" + 3
哪一行:

y=10x+3
相应的数据表为:

table

当我们添加10 菜单项,我们发送103 POST变量。

数据:

仅显示$_POST 仅使用保存菜单时的数据5 项目:

Array
(
    [menu-name] => simple_menu
    [save_menu] => Save Menu
    [closedpostboxesnonce] => xxxxxxxxxx
    [meta-box-order-nonce] => xxxxxxxxxx
    [update-nav-menu-nonce] => xxxxxxxxxx
    [_wp_http_referer] => /dev/wp-admin/nav-menus.php
    [action] => update
    [menu] => 58
    [menu-item-title] => Array
        (
            [1135] => home
            [1131] => page1
            [1130] => page2
            [1132] => page3
            [1133] => page4
        )

    [menu-item-attr-title] => Array
        (
            [1135] => 
            [1131] => 
            [1130] => 
            [1132] => 
            [1133] => 
        )

    [menu-item-classes] => Array
        (
            [1135] => 
            [1131] => 
            [1130] => 
            [1132] => 
            [1133] => 
        )

    [menu-item-xfn] => Array
        (
            [1135] => 
            [1131] => 
            [1130] => 
            [1132] => 
            [1133] => 
        )

    [menu-item-description] => Array
        (
            [1135] => 
            [1131] => 
            [1130] => 
            [1132] => 
            [1133] => 
        )

    [menu-item-db-id] => Array
        (
            [1135] => 1135
            [1131] => 1131
            [1130] => 1130
            [1132] => 1132
            [1133] => 1133
        )

    [menu-item-object-id] => Array
        (
            [1135] => 477
            [1131] => 1020
            [1130] => 1028
            [1132] => 791
            [1133] => 603
        )

    [menu-item-object] => Array
        (
            [1135] => page
            [1131] => page
            [1130] => page
            [1132] => page
            [1133] => page
        )

    [menu-item-parent-id] => Array
        (
            [1135] => 0
            [1131] => 0
            [1130] => 1131
            [1132] => 1131
            [1133] => 0
        )

    [menu-item-position] => Array
        (
            [1135] => 1
            [1131] => 2
            [1130] => 3
            [1132] => 4
            [1133] => 5
        )

    [menu-item-type] => Array
        (
            [1135] => post_type
            [1131] => post_type
            [1130] => post_type
            [1132] => post_type
            [1133] => post_type
        )

    [menu-locations] => Array
        (
            [primary] => 0
        )

)
当我添加3 “项目到它们”菜单POST 数据为:

Array
(
    [action] => add-menu-item
    [menu] => 58
    [menu-settings-column-nonce] => xxxxxxxxxx
    [menu-item] => Array
        (
            [-56] => Array
                (
                    [menu-item-object-id] => 1728
                    [menu-item-db-id] => 0
                    [menu-item-object] => page
                    [menu-item-parent-id] => 0
                    [menu-item-type] => post_type
                    [menu-item-title] => Page 1
                    [menu-item-url] => http://example.com/page1/
                    [menu-item-target] => 
                    [menu-item-classes] => 
                    [menu-item-xfn] => 
                )

            [-57] => Array
                (
                    [menu-item-object-id] => 1724
                    [menu-item-db-id] => 0
                    [menu-item-object] => page
                    [menu-item-parent-id] => 0
                    [menu-item-type] => post_type
                    [menu-item-title] => Page 3
                    [menu-item-url] => http://example.com/page2/
                    [menu-item-target] => 
                    [menu-item-classes] => 
                    [menu-item-xfn] => 
                )

            [-59] => Array
                (
                    [menu-item-object-id] => 1658
                    [menu-item-db-id] => 0
                    [menu-item-object] => page
                    [menu-item-parent-id] => 0
                    [menu-item-type] => post_type
                    [menu-item-title] => Page 3
                    [menu-item-url] => http://example.com/page3/
                    [menu-item-target] => 
                    [menu-item-classes] => 
                    [menu-item-xfn] => 
                )

        )

)

结束