add\\u menu\\u页面的第五个参数的类型为callable. 因此,您不能只给它“test.php”并期望它加载。但你可能会这样做:
// Include the fine with some function for example bananaMonday() declared
include_once( __DIR__ . \'/test.php\' );
// And then use it as param for add_menu_page
add_menu_page(\'Test\', \'test\', \'manage_options\', \'test\', \'bananaMonday\', null, 6);
因此,最终您的完整代码将是这样的。
functions.php
function se331925_custom_menu_page() {
// Include the fine with some function for example bananaMonday() declared
include_once( __DIR__ . \'/test.php\' );
// And then use it as param for add_menu_page
add_menu_page(\'Test\', \'test\', \'manage_options\', \'test\', \'bananaMonday\', null, 6);
}
add_action( \'admin_menu\', \'se331925_custom_menu_page\' );
test.php
function bananaMonday() {
echo \'<h1>Hello, it\\\'s monday\';
}