Escapin apostrophes in Word Press
-
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:
$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.
I have also tried this:
$dinnerEntree2 = stripslashes_deep( $_POST[$dinnerEntree_option] );
That doesn’t do it either.
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?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Escapin apostrophes in Word Press’ is closed to new replies.