Prevent Admin gui output from page added using add_submenu_page

I think you’ll have to hook an earlier action and check if your subpage is being loaded, when the function to render the subpage happens it’s too late to send headers. Your subpage’s rendering function could just be blank because the earlier action would override it. I tried this with a subpage of themes.php and it seemed like it would work:

function wpa82041_do_download(){
    global $pagenow;
    if( 'themes.php' == $pagenow
    && 'spn_download' == $_GET['page'] ){
        // do your download stuff
    }
}

add_action( 'admin_init', 'wpa82041_do_download' );

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)