Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WordPress add_submenu_page gives incorrect url

Tags:

php

wordpress

I have a bug I can't seem to resolve.
I have this line in a statically written class:

add_submenu_page( 
    'ib_inbound_main',
    'Analyics Configuration',
    'Analytics',
    'edit_pages',
    'ib_analytics_config',
    array ('ib_analytics_admin_panels', 'render_config_panel')
);

Which is generating this link:

<a href="ib_analytics_config" class="wp-first-item">Analytics</a>

Which is missing admin.php?page=
Can anyone see why this is occurring?

like image 269
green green grass Avatar asked Sep 08 '14 10:09

green green grass


1 Answers

The reason the URL was generated incorrectly is because I was trying to create the submenu page before the main menu item existed.

It should have been obvious but I was thrown off the scent because the menu appeared to otherwise generate correctly - I thought that building the admin menus out of sequence would have white screened WordPress.

like image 162
green green grass Avatar answered Nov 10 '22 12:11

green green grass