Title: Customiser &amp; Sanitization
Last modified: April 19, 2017

---

# Customiser & Sanitization

 *  [tascam424](https://wordpress.org/support/users/tascam424/)
 * (@tascam424)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/customiser-sanitization/)
 * Hi folks i’m hoping someone can assist me. I’m learning WordPress Theme Development
   and i’m just at the point of adding options in the customiser. I’m not sure how
   to correctly deal with html in a text area. I want to make sure that the texture
   is sanitised and safe, but also allow it to output HTML. This is the function
   and code that i’m using.
 *     ```
       $wp_customize->add_setting( 'fs_theme_footer', array(
       	'default' => '',
       	'type' => 'theme_mod',
       	'capability' => 'edit_theme_options',
       	'transport' => '',
       	'sanitize_callback' => 'esc_textarea',
       ) );
       $wp_customize->add_control( 'fs_theme_footer', array(
           'type' => 'textarea',
           'section' => 'fs_theme_footer',
           'label' => __( 'Textarea Field', 'fluidstudio' ),
           'description' => '',
       ) );
       ```
   
 * In my theme
 * `<?php echo ( get_theme_mod( 'fs_theme_footer', '' ) ); ?>`
 * I have tried different variations of esc_url etc but i can’t seem to get the 
   output to correctly display as html, instead the full html code shows on the 
   front end.
 * Any help would be greatly appreciated.
 * Thanks

Viewing 1 replies (of 1 total)

 *  [HudsonValleyWebDesign](https://wordpress.org/support/users/jaycbrf/)
 * (@jaycbrf)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/customiser-sanitization/#post-9049555)
 * This is what I use in my Customizer fields
 *     ```
       /**
          *	Sanitizes the text that's saved in the options to remove any code
          *	@param 	array 	$options               		The array of options to be sanitized
          *	@param 	array  	$sanitized_options		The array of sanitized options
          *	
       **/	
   
       function sanitize_fieldName ( $options ) {
   
       	$sanitized_options  = array();
   
       	foreach( $options as $option_key => $option_val ) {
   
       		$sanitized_options [ $option_key ] = strip_tags( stripslashes( $option_val ) );
   
       	} // end foreach
   
       	return $sanitized_options;
   
       } // end sanitize_text_options
       ```
   
 * Hope this works for you.

Viewing 1 replies (of 1 total)

The topic ‘Customiser & Sanitization’ is closed to new replies.

## Tags

 * [Customiser](https://wordpress.org/support/topic-tag/customiser/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 1 participant
 * Last reply from: [tascam424](https://wordpress.org/support/users/tascam424/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/customiser-sanitization/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
