Load admin bar without wp_head or wp_footer [duplicate]

Looks like, the only solutions which worked was to call admin bar directly.

if (current_user_can('administrator') || current_user_can('editor')) {
 wp_admin_bar_render();
}

error code: 523