We build our sites with a custom theme options panel in the Dashboard so that clients can manage as much of their site on their own as possible. All seemed fine and dandy until the client threw in an apostrophe! The chutzpah. Can’t you just use “We will” instead of “We’ll”?

The problem was that when an apostrophe was entered into a custom text label in the options panel, a slash decided to come along for the ride. Example: Instead of seeing “We’ll send you a link”, the site displayed “We\’ll send you a link”. I searched around and finally found this post, Using stripslashes() with Theme Options which explains that you need to use the stripslashes function when you return the content stored in the custom text.

Basically, you just wrap stripslashes() around the get_option like so:

If you had <?php  echo get_option(‘cgn_404_text’); ?>

it would now be:

<?php  echo stripslashes(get_option(‘cgn_404_text’)); ?>

In your custom-text.php file, you’ll probably use something like this:

<?php echo  stripslashes($selected_book_description); ?>
No more slashtastrophies!