最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

admin menu - Linked pages not working with wordpress

programmeradmin1浏览0评论

I used this code to create a menu page which loads mypluginpage.php and it works fine with my plugins.

I can access it from something like http://mysite/wp-admin/admin.php?page=myplugin

<?php

// Add menu
function myplugin_menu() {

    add_menu_page("myplugin", "my plugin","manage_options", "myplugin", "mypluginpage",plugins_url('/myplugin/img/icon.png'));
}

add_action("admin_menu", "myplugin_menu");

function mypluginpage(){
    include "mypluginpage.php";
}

Here is my issue: Inside mypluginpage.php below, I have a link that should take me to welcome.php within admin page

<?php 
wp_head();
?>

<a href="<?php echo admin_url('welcome.php'); ?>">Take me to welcome page within admin</a>

<?php
wp_footer();

I thought am supposed to have something like this link below which will still keep me within admin page

http://mysite/wp-admin/admin.php?page=welcome

but I got

http://mysite/wp-admin/welcome.php

which leads me to page not found

I need to have welcome.php page to called within admin. any help will be appreciated..

I used this code to create a menu page which loads mypluginpage.php and it works fine with my plugins.

I can access it from something like http://mysite/wp-admin/admin.php?page=myplugin

<?php

// Add menu
function myplugin_menu() {

    add_menu_page("myplugin", "my plugin","manage_options", "myplugin", "mypluginpage",plugins_url('/myplugin/img/icon.png'));
}

add_action("admin_menu", "myplugin_menu");

function mypluginpage(){
    include "mypluginpage.php";
}

Here is my issue: Inside mypluginpage.php below, I have a link that should take me to welcome.php within admin page

<?php 
wp_head();
?>

<a href="<?php echo admin_url('welcome.php'); ?>">Take me to welcome page within admin</a>

<?php
wp_footer();

I thought am supposed to have something like this link below which will still keep me within admin page

http://mysite/wp-admin/admin.php?page=welcome

but I got

http://mysite/wp-admin/welcome.php

which leads me to page not found

I need to have welcome.php page to called within admin. any help will be appreciated..

Share Improve this question edited Sep 28, 2019 at 2:59 fuxia 107k39 gold badges255 silver badges459 bronze badges asked Sep 27, 2019 at 20:46 chinazaikechinazaike 1072 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

My problem was resolved by creating a sub menu page using add_submenu_page() function. Thanks.

发布评论

评论列表(0)

  1. 暂无评论