我使用admin\\u url()wordpress函数解决了这个问题。为了链接到插件中的另一个页面,甚至链接到我项目中的另一个插件,我将注册的url传递给admin\\u url()函数。
<a href="<?php echo admin_url(\'admin.php?page=edit-member-page&id=\'.$id);?>">John Smit`h</a>
//传递给链接的$id变量将使用`$\\u GET[\'id\']检索;edit\\u成员上的superglobal。phpBut第一个url sluf:
edit-member-page 首先应该在插件或函数中注册。php
in my plugin main
//add menu call back
function load_edit_member_page_callback(){
include_once("edit_member.php")
}
//add admin menu action
add_action(\'admin_menu\',\'register_edit_member_fun\');
//implement register_edit_member_fun function
function register_edit_member_fun(){
add_menu_page(
\'edit member\', //page title
\'\', //menu title (I left it blank because I don\'t want the menu to appear to users. I just need to make use of the slug to link internally
\'manage_options\', //capability
\'edit-member-page\', //slug, this is what I passed to hre attribute above
\'load_edit_member_page_callback\',//callable function
);
}
希望这对别人有帮助。