Support » Plugins » Hacks » Custom admin page not working

  • Resolved MrEinStain

    (@mreinstain)


    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. 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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()

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom admin page not working’ is closed to new replies.