插件的内容没有出现在wordpress的菜单页面上

时间:2013-07-30 04:24:08

标签: php wordpress

我正在为wordpress编写一个插件。

function dbpresent_admin() {  
include('default.php');  
}
function dbpresent_admin_actions() {  
add_management_page("DB Presentor", "DB Presentor", 1, "db_presentator", "dbpresent_admin");
}  
add_action('admin_menu', 'dbpresent_admin_actions');

这是我尝试从default.php文件中显示内容的代码部分,但是当我点击wordpress中的菜单项时,它会打开页面但不显示任何数据,请帮助我

1 个答案:

答案 0 :(得分:0)

包含路径对我来说是错误的 - 将其更改为要求,您应该看到错误。

很可能你想使用像

这样的东西
include( plugin_dir_path( __FILE__ ) . 'default.php' );

或者,要求它是必需的文件。

require( plugin_dir_path( __FILE__ ) . 'default.php' );