1. Home
  2. Docs
  3. WordPress Studio Framework
  4. How-To…
  5. Sanitize

Sanitize

Example Sanitization

array(
  'id' => 'example-text',
  'type' => 'text',
  'title' => 'Example Text',
  'sanitize' => 'wpsf_sanitize_replace_a_to_b',
),

In this example, we will have a function that replaces all letter ‘a’ with letter ‘b’.

if ( ! function_exists( 'wpsf_sanitize_replace_a_to_b' ) ){
  function wpsf_sanitize_replace_a_to_b( $value ){
    return str_replace( 'a', 'b', $value );
  }
}
Was this article helpful to you? Yes No

How can we help?