Escaping apostrophes in wordpress

I wrote a plugin for wordpress that stores restaurant menu items. But whenever apostrophes are used, wordpress escapes them with slashes on both the admin and front end and keeps adding slashes to the text on every save.

This is an excerpt and example of what I have as post code:

Read More
$dinnerEntree2 = $_POST[$dinnerEntree_option];
for ($i=1; $i<= $dinner_menu_item_number_saved; $i++) {

// entree   dinner_menu_entree_option
$dinnerEntree = "dinner_menu_".$i."_entree";
$dinnerEntree_saved = "dinner_menu_".$i."_entree_save";
$dinnerEntree_option = "dinner_menu_".$i."_entree_option";
$dinnerEntree_saved2 = get_option($ingredients);
$dinnerEntree2 = $_POST[$dinnerEntree_option];

if ($dinnerEntree_saved2 != $dinnerEntree2)
if(!update_option($dinnerEntree,$dinnerEntree2))
$message='failed to save large entree';
// end of entree

and in the input form field:

<input type="text" name="dinner_menu_<?php echo $i ?>_entree_option" value="<?php echo get_option($dinnerEntree);  ?>" size="40"/></span>

I have tried stripslashes, but have had no luck. This has been discussed over the years but i have seen no definitive solution for wordpress. Magic Quotes are off on my server…. any ideas?

Related posts

Leave a Reply

1 comment