I have a Theme Options page where the user can add certain options like Facebook links, etc. One of the options is for some ad code and when saving it as an option it gets escaped over and over again.

What’s the best approach for saving code inserted in an admin page <textarea> using update_option( 'sidebar_code', $_POST['sidebar_code'] ); ?

3 s
3

stripslashes(wp_filter_post_kses(addslashes($_POST['sidebar_code'])));

but you should know that the kses filter is not 100% safe.

Leave a Reply

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