I’ve tried to import an option value via update_options($name, $value) where $value has special characters (like apostrophe’s for example) and I’ve noticed that the apostrophe gets stripped out of the text before it reaches the database.

What is the suggested sanitization of strings prior to sending them to update_options()?

3 s
3

Try esc_html( $string ) (Codex ref), which among other things encodes single- and double-quotes.

For further reference, see the Data Validation entry in the Codex.

Leave a Reply

Your email address will not be published. Required fields are marked *