How to sanitize an admin text field but still allow quotes?

I have a text area where users can enter a paragraph or two of information. They want to be able to embed links, specify bold and italic, force line breaks, and include quotes around strings. I started with:

$note = sanitize_text_field($note);

which just cleaned everything up. I thought wp_kses would be my answer:

   $allowed_html = [
            'a'      => [
                'href'  => [],
                'title' => [],
            'br'     => [],
            'em'     => [],
            'strong' => [],
        $note= wp_kses( $note, $allowed_html );

But it escapes any single or double quotation mark. Is there a way to use sanitation to allow certain HTML and ALSO allow single and double quotation marks?



Source link