WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] WP Inserting \ in front of " or ' (8 posts)

  1. mahodder
    Member
    Posted 7 years ago #

    I have an issue where WP seems to insert \ in front of any " or ' characters. It does not do this on the posts or pages but it does do it when I receive an e-mail from my contact form (GPixel-Contact plugin).

    This isn't so bad but I have also integrated a forum into my WP site. Any posts in the forum also have a \ placed in front of any quotations.

    Why does WP do this? Is there any way to turn this off or does it serve some purpose?

  2. mahodder
    Member
    Posted 7 years ago #

    No ideas?

  3. Doodlebee
    Member
    Posted 7 years ago #

    but it does do it when I receive an e-mail from my contact form (GPixel-Contact plugin).

    Contact the plugin author.

    They forgot to put in "stripslashes" in the code. I don't know the code, or I'd tell you where to put it - so you need to contact the plugin author and inform them.

    Why does WP do this?

    WP *doesn't* do this. PHP does if the command to strip the slashes isn't put in the form code. It's a PHP thing, not a WordPress thing.

  4. mahodder
    Member
    Posted 7 years ago #

    So is there any global option in PHP to turn this off? When people are posting in my forum it also inserts \ in front of any quotes. It didn't start to do this until I integrated WP functions into my forum.

  5. pizdin_dim
    Member
    Posted 7 years ago #

    "So is there any global option in PHP to turn this off?"

    Yes, there is. Change magic_quotes_gpc to off.

  6. mahodder
    Member
    Posted 7 years ago #

    Thank you! I will give that a try.

  7. mahodder
    Member
    Posted 7 years ago #

    hmmmm magic_quotes_gpc are already off, guess that wasn't it :(

  8. mahodder
    Member
    Posted 7 years ago #

    The slash problem seems to be caused by the fact that recent versions of WordPress slash everything that gets posted. Unfortunately, Vanilla isn’t expecting this.

    You can keep these slashes from appearing by adding, the following lines at the end of your Vanilla database.php file:

    $_GET = stripslashes_deep($_GET );
    $_POST = stripslashes_deep($_POST );
    $_COOKIE = stripslashes_deep($_COOKIE);

    Author of above code: filosofo

    Finally a workaround!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags