• Resolved nancy56

    (@nancy56)


    We used this code to create a menu page which loads mypluginpage.php
    and it works fine.

    I can access it from something like https://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'); ?>">welcome page</a>
    	
    <?php
    wp_footer();

    I thought am supposed to have something like this link within the admin
    https://mysite/wp-admin/admin.php?page=welcome

    but I got direct to link below when I click on Welcome Page link

    https://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..

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    The admin_url() function is not very smart, it simply appends whatever you pass to it to the admin path. It doesn’t do any interpretation. You have to pass exactly what you want the URL to be.
    admin_url( 'admin.php?page=welcome')

    Thread Starter nancy56

    (@nancy56)

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘linked page not working with my wordpress plugins’ is closed to new replies.