此通知可由函数的多个变体/包装触发add_submenu_page
.
自WP v5.8起
添加插件页面添加用户页面添加评论页面添加管理页面添加选项页面u theme\\u page为了缩小范围,寻找合适的函数,我们可以修改核心文件./wp-admin/includes/plugin.php
(约1420行)更详细。
_doing_it_wrong(
__FUNCTION__,
sprintf(
/* translators: %s: add_submenu_page() */
__( \'The seventh parameter passed to %s should be an integer representing menu position. %s\' ),
\'<code>add_submenu_page()</code>\',
print_r( $new_sub_menu, true )
),
\'5.3.0\'
);
在我的例子中,冒犯的功能是
add_dashboard_page
add_dashboard_page(
\'Link Builder\',
\'Link Builder\',
\'manage_options\',
\'mytheme-woocommerce-helper\',
array( $this, \'mytheme_woocommerce_helper_create_admin_page\' ),
\'dashicons-admin-generic\',
2
);
编辑核心文件前注意事项:
PHP Notice: add_submenu_page was called <strong>incorrectly</strong>.
The seventh parameter passed to <code>add_submenu_page()</code>
should be an integer representing menu position.
Please see <a href="https://wordpress.org/support/article/debugging-in-wordpress/">Debugging in WordPress</a> for more information.
(This message was added in version 5.3.0.) in wp-includes/functions.php on line 5535
编辑核心文件后注意事项:
PHP Notice: add_submenu_page was called <strong>incorrectly</strong>.
The seventh parameter passed to <code>add_submenu_page()</code>
should be an integer representing menu position.
Array
(
[0] => Link Builder
[1] => manage_options
[2] => mytheme-woocommerce-helper
[3] => Link Builder
)
warning/disclaimer/notes
仅在开发实例中执行此编辑。WP core更新或升级将还原更改。wordfence之类的插件将发出警告,并可能恢复更改。