How to properly sanitize strings for update_option()

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()?

Related posts

Leave a Reply

3 comments

  1. You should not use esc functions for data that’s going into the database. esc functions are for output only.

    The update_option() function sanitizes for you, so there’s no need to run any extra san functions.