I want to clean up my theme options because I can’t keep track of everything. How can I get my page_callback to link to a file sintead of a callback?
I know that I could include the file in the callback but why if I can simply call the file here?
add_submenu_page(
null // -> Set to null - will hide menu link
, 'Page Title' // -> Page Title
, 'Menu Title' // -> Title that would otherwise appear in the menu
, 'administrator' // -> Capability level
, 'menu_handle' // -> Still accessible via admin.php?page=menu_handle
, 'page_callback' // -> To render the page
);
Instead of running to trac and complaining about a missing feature, I suggest to make use of an OOP construct:
This isn’t the final thing, but it should bring you on route to get stuff better organized.
Simply put – because callback is sufficient to do anything, including loading file. 🙂 It’s not worth complicating logic for something that is already not only possible but trivial.