Advertisement
marstheme

Untitled

Jan 17th, 2016
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. if( ! function_exists( 'themename_sanitize_my_input' ) ){
  2.     /**
  3.      * a tag, href and title attr only.
  4.      * @param string $text
  5.      * @return string
  6.      */
  7.     function themename_sanitize_my_input( $text = null ) {
  8.         if( empty( $text ) ){
  9.             return;
  10.         }
  11.        
  12.         $text   =   wp_kses( $text , array(
  13.             'a' => array(
  14.                 'href' => array(),
  15.                 'title' => array()
  16.             )
  17.         ));
  18.         return $text;
  19.     }
  20. }
  21.  
  22. // WP customizer.
  23. $wp_customize->add_setting( 'my-setting-id' , array(
  24.     'default'           => '',
  25.     'capability'        => 'edit_theme_options',
  26.     'sanitize_callback' => 'themename_sanitize_my_input'
  27. ));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement