0

I'm working on my first plugin, and I'm using something like this to add a submenu under Settings:

add_options_page(
    'Page Title',
    'Menu Title',
    'edit_theme_options',
    'my-plugin-menu-slug',
    array($this, 'options_page')
);

The trouble is that this adds the entry on the top of the submenu, as pictured below.

wp-admin menu

How can I get it to add the entry at the end of the list instead?

1

When calling add_options_page make sure to call it on the admin_menu action/event, so it's called at the correct time

add_action('admin_menu', function () {
    add_options_page( .... );
} );

You may be able to gain further control by specifying the priority of the action in the add_action call

  • Thanks! I had been calling it from init instead of admin_menu. This did the trick! – soapergem Sep 22 '17 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.