WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page

I am creating a wordpress plugin that has it’s own UI. It looks like a standard web application, so everything that is done within the plugin is handled in this UI instead of integrating it with the WP admin area. My issue seems to be that I can’t get it to load as a separate page, I can only get it to load in a page created in the admin area with the UI embedded in the content block. When I add it to the menu like this:

// Add plugin UI submenu item
    'myPlugin', 'myPlugin WP', __('myPlugin UI', 'myPlugin'),
    $capability, 'myPlugin-ui', 'myPlugin_router'

And have it accessing the page as such:

    function myPlugin_router() {

        // Get current screen details
        $screen = get_current_screen();

    if(strpos($screen->base, 'myPlugin-ui') !== false) {


Is this because I am using “include” to add it, so it is loading it as a template?

I am also planning on using this UI the same way wordpress admin does, and load separate pages inside of the content area of the UI, exactly the way WP is doing it to my UI. So it uses templates. Would I just use include like above to do so?

Solutions Collecting From Web of "WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page"

I’ll preface this by saying I think it’s a really bad idea, but you could circumvent the admin UI by hooking an action that happens after things are initialized, but before any output occurs:

function my_admin_ui(){
    if( isset( $_GET['page'] )
        && 'myPlugin-ui' == $_GET['page'] ){
            include( plugin_dir_path( __FILE__ ) . 'views/myPlugin-ui.php' );
add_action( 'admin_init', 'my_admin_ui', 999 );