I'm building a simple plugin that will allow us to add code to our site header by defining it on our settings page. However I haven't been able to make it allow scripts.
This is my current code:
public function sanitize( $input )
{
$new_input = array();
if( isset( $input['code'] ) )
$new_input['code'] = sanitize_text_field( $input['code'] );
return $new_input;
}
public function code_callback()
{
printf(
'<textarea type="text" id="code" name="pl-analytics[code]">%s</textarea>',
isset( $this->options['code'] ) ? esc_attr( $this->options['code']) : ''
);
}
How can this be done?
<script>
tag (or any HTML tag for that matter) inside your text-area, it will strip it.