WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Custom admin page not working (3 posts)

  1. MrEinStain
    Member
    Posted 2 years ago #

    Hello there,

    I am writing a simple plugin. The plugin adds a custom admin page under the Dashboard menu (under the Upgrade link). The link appears there properly, however the content of the page is inserted above all pages, including those not in the wp-admin.

    Here's the code that adds the page to the menu:

    function wp_video_option_page() {
      add_submenu_page('index.php', 'Educational WordPress Videos', 'Video Tutorials', 'manage_options', 'videotuts', 'wp_videos_page');
    }
    add_action('admin_menu', 'wp_video_option_page');

    I copied an example from the Codex, however I get the exact same result. I also checked a few other plugins, but they use the same method as I do, but they work fine, mine doesn't. Is there a way to only display a certain page on that actual page? Is there a line of code I'm missing?
    Thanks for your help. :-)

  2. s_ha_dum
    Member
    Posted 2 years ago #

    The link appears there properly, however the content of the page is inserted above all pages, including those not in the wp-admin.

    Something is wrong in your callback function. What does that look like? Paste it to the pastebin if is more than 10 lines.

    Also, strictly speaking you should probably be using add_dashboard_page()

  3. MrEinStain
    Member
    Posted 2 years ago #

    Oops... Thanks for bringing it to my attention. I checked the file three times. Only now that you mentioned it I realised I forgot to put the page in a function... My bad.

    Thanks again, it's working properly now.

Topic Closed

This topic has been closed to new replies.

About this Topic