I have some submenu admin pages generated by code in an array of anonymous functions generated with a loop:
for ($i = 0; $i < count($tables); $i++) {
$funcs[$i] = function() {
// do stuff..
}
when I add my submenu pages by referencing the elements of my funcs array, I get the permissions error:
for ($i=0;$i<count($tables);$i++) {
add_submenu_page( 'bilby_bo', $tables[$i][form], $tables[$i][form], 'manage_options', 'admin.php?page=bilby_bo_'.$tables[$i][form], $funcs[$i] );}
Can you see what I'm doing wrong?