Customizer Codes:
$wp_customize->add_setting (
'script-code',
array (
'default' => esc_html__( 'Script Code', 'x' ),
'sanitize_callback' => 'wp_kses_post'
)
);
$wp_customize->add_control (
new WP_Customize_Control (
$wp_customize,
'script-code',
array (
'label' => esc_html__( 'Script Code', 'x' ),
'section' => 'script',
'settings' => 'script-code',
'type' => 'textarea',
'priority' => 1
)
)
);
Photo from Customizer:
from codes for output:
<?php echo wp_kses_post(get_theme_mod('script-code')); ?>
from output, return the empty:
<main class="script-code">
</main>
How can I use script tag in Customizer textarea setting field ?
Thanks so much.