I'm trying to hide attachment_1 on certain pages, but the code below doesn't work for me:

hook_views_pre_build(&$view) {
if ($view->name == 'calendar'){
unset($view->attachment_before);
}
}

This attachment is attached to page (before). Is there any other possibility to exclude attachment from display when concrete argument is provided to the page?

Thanks in advance.