The $function
argument of add_menu_page
should be a function that produces your page output, or if omitted, then the $menu_slug
argument can be a file that when included will output the menu page.
But your output right now has nothing to do with the add_menu_page
call, the problem is that you’re requiring aio_dashboard.php
, which has a function hooked to current_screen
. The current_screen
action should not generate output, that’s not what it’s for, it fires too early in the load process. Its purpose is for adding filters and actions based on the current admin page being viewed.
Change the add_menu_page
$function
argument to contain the function that outputs the page content, remove the add_action
call hooking that function to current_screen
.