我不建议你那样做。
让我们假设您的前缀为admin.php
是_trigger_me_
子菜单
<?php
function _clean_url_to_repalce_admin_menu($url, $original_url, $_context){
if ($url == \'admin.php?page=_trigger_me_\'){
remove_filter(\'clean_url\', \'_clean_url_to_repalce_admin_menu\', 10);
//return admin_url(\'someotherpage.php);
return \'http://google.com/\';
}
}
if (is_admin())
add_filter(\'clean_url\', \'_clean_url_to_repalce_admin_menu\', 10, 3);
主菜单
<?php
function custom_admin_menu_action_hook(){
global $menu;
foreach($menu as $k=>$item){
if ($item[2] == \'_trigger_me_\'){
$menu[$k][2] = \'http://google.com\';
}
}
}
add_action(\'admin_menu\', \'custom_admin_menu_action_hook\', 100);
我把这两个例子都称为“黑客”。他们可能这样做,但最好不要这样做。
使现代化
if case if满足重定向=)
<?php
$hook = add_submenu_page($parent, $title, $menu_title, \'manage_option\', \'callback\');
add_action("load-{$hook}", create_function(\'\',\'
header("Location:", admin_url("someurl.php?blahblahblah"));
exit;
\'));
如果您想用分类法页面替换此页面(
edit-tags.php
)
<?php
add_action(\'admin_menu\', \'admin_menu_edit_tags_page\');
function admin_menu_edit_tags_page(){
// please set $YOURPARENTSLUG as parent slug of your menu item (parent of your menu)
// manage_tags to manage_terms of your taxonomy capability (its visible whan you var_dump($wp_taxonomies[$taxonomyyouwant]));
add_submenu_page($YOURPARENTSLUG, \'menu\', \'title\', \'manage_tags\', \'edit-tags.php?taxonomy=taxonomy\');
}