I’m using the Option API for my theme settings page. I use the $_POST data to update the options when the changes are saved. My issue is that the strings I send get escaped and when I use this code:

<?php echo get_option('myOption'); ?>

it echoes the escaped string.

So for example, say ‘myOption’ = Bob’s Diner

Using the above statement, it echoes Bob\’s Diner, which is definitely not what I want.

How exactly do I go about removing that backslash when I call the option on the site?

1 Answer
1

You can use PHP’s stripslashes() command:

<?php echo stripslashes( get_option( 'myOption' ) );

Leave a Reply

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