”’ character shows up as “‘” in php output

I am working on a post type form. The site is wordpress based. While testing the form, I noticed that everytime I use the ”’ character, when the post is posted, it prints out “‘” instead.

For example:

Read More

Input: “Bob’s birthday plans.”
Output: “Bob’s birthday plans.”

How do I stop php or wordpress, whichever is responisble, from doing this?

Related posts

Leave a Reply

3 comments

  1. Those are Magic Quotes, one of the most controversial features of PHP.

    It is an option in PHP.ini, you should contact your hosting service and have them shut it off (Or look for the option yourself, if you are privileged enough to).

  2. There seems to be a problem with magicquotes and according to this site, the fix consists in adding the following lines to your theme file:

    if ( get_magic_quotes_gpc() ) {
        $_POST      = array_map( 'stripslashes_deep', $_POST );
        $_GET       = array_map( 'stripslashes_deep', $_GET );
        $_COOKIE    = array_map( 'stripslashes_deep', $_COOKIE );
        $_REQUEST   = array_map( 'stripslashes_deep', $_REQUEST );
    }
    

    Which would translate to something like, if magic quotes are enabled, remove the slashes from those variable arrays. Therefore fixing your issue.