Having troubles with add_menu_page() function
-
I am working with a plugin and I’m trying to understand why I’m not able to add menu page. Interestingly enough, I acceidentally called the function that’s in charge of adding my pages in my template plugin project and it worked. So does anyone know why the add_menu_page function isn’t working in my plugin but will work in another one.
(Following function is inside a class called MenuCreation)
public static function createMenu() { $menu_pages = get_option('menu_pages'); $menu_pages['home'] = add_menu_page( 'Welcome to Manager', 'Manager', 'administrator', 'home', 'MenuCreation::menuCallback', 'dashicons-layout' ); }
(Inside a separate Admin class)
add_action('admin_menu', array('MenuCreation', 'createMenu'));
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Having troubles with add_menu_page() function’ is closed to new replies.