The only way I was able to make it work was that:
functions.php
function test_customizer( $wp_customize ) {
$wp_customize->add_setting( 'themeslug_text_setting_id', array(
'capability' => 'edit_theme_options',
'default' => 'Lorem Ipsum',
'sanitize_callback' => 'sanitize_textarea_field',
) );
$wp_customize->add_control( 'themeslug_text_setting_id', array(
'type' => 'text',
'section' => 'title_tagline', // Add a default or your own section
'label' => __( 'Custom Text' ),
'description' => __( 'This is a custom text box.' ),
) );
}
Front (ex. index.php)
<?php $themeslug_text_setting_id = get_theme_mod('themeslug_text_setting_id');
if ($themeslug_text_setting_id) {
echo nl2br( esc_html( $themeslug_text_setting_id ) );
} ?>
The sanitize_textarea_field
is fundamental here.