Adding an Options Page to a Plugin

The first set of code adds a menu item to the sidebar. I’m attempting to add an options page (the type which shows up as a sub-page) under this. I tried to do so with the second code… but this isn’t working.

How do I add an options page under a plugin’s menu?

// Add menu page in sidebar
function admin_menu_wlseo() {
  add_menu_page('SEO', 'SEO', 'manage_options', 'wlseo', 'options_page_wlseo');
}

// Add options page in sidebar
function admin_stuff_wlseo() {
  add_options_page('Stuff', 'Stuff', 'manage_options', 'wlseo-stuff', 'options_page_wlseo');
}

Related posts

1 comment

  1. @AndrettiMilas, If you really need a top level menu item (which is not encouraged), you should use add_submenu_pageinstead of add_options_page. Please refer to the Codex for the required parameters.

    You could add the submenu like:

    add_submenu_page( 'wlseo', 'Submenu 1', 'Submenu 1', 'manage_options', 'wlseo-submenu-1');

Comments are closed.