I was trying to create a custom menu callback without other regions for a splash page that would be viewed via an iframe for new site visitors, but I still wanted the theming for the site. Pierre's suggestion is perfectly fine, and easy to implement, but wanted to try another approach that would avoid having to loop over every region of every page for every page request. So instead I implemented my own "delivery callback" for my menu router item (https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_menu/7), which was basically a straight copy of drupal_deliver_html_page() https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_deliver_html_page/7, with the exception of a single line
elseif (isset($page_callback_result)) {
// Print anything besides a menu constant, assuming it's not NULL or
// undefined.
print drupal_render_page($page_callback_result);
}
Became...
elseif (isset($page_callback_result)) {
// Print anything besides a menu constant, assuming it's not NULL or
// undefined.
print my_custom_render_page_function($page_callback_result);
}
My custom function pretty much stayed the same, except I added Pierre's foreach loop just before the return statement:
// Hide all but the content area for a splash calback.
foreach (element_children($page) as $region) {
$page[$region]['#access'] = ($region == 'content');
}
return drupal_render($page);
This way I'm not repeating the same unnecessary logic on every page to support a use case for ~1% of page requests. Whether this is worth it is up to debate, it is a lot of re-implemented core code that would now have to be maintained outside of the Drupal community.