And I thought I knew Wordpress well. Now it seems that update_option () automatically resets the code. If I want to save some Javascript or HTML code in options, this behavior makes the code unusable.
I refuse to do str_replace on the return value in order to filter out every backslash. There must be a better way.
Here's the PHP for the text box to enter some code:
$option = unserialize(get_option('option'));
<textarea name="option[box]"><?php echo $option['box']; ?></textarea>
This is what happens after the form is submitted (essentially):
update_option('option', serialize($_POST));
Any ideas?
: , PHP stripslashes(), script, htmlentities (stripslashes()) , , , , .