Support » Fixing WordPress » Why are all ' being changed to \' in the body of emails sent by wp_mail()?

  • mtpultz

    (@mtpultz)


    I’d like to stop wp_mail() from changing ‘ to \’ so my clients can read emails the way they were written. For example not change don’t and won’t to don\’t, won\’t etc.

    Any suggestions? I’ve looked through the codex at wp_mail() and forum entries but can’t find a similar entry.

    Cheers

Viewing 1 replies (of 1 total)
  • mtpultz

    (@mtpultz)

    Found a site that had the fix:
    http://fearlessflyer.com/2009/08/getting-rid-of-unwanted-backslashes-in-wordpress-form-input/

    Work around for PHP Magic Quotes which are stripped in the code pasted below. PHP Magic Quotes will be deprecated in PHP 5.3 for good.

    <?php
    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 );
    }
    ?>

    Hope this helps

Viewing 1 replies (of 1 total)
  • The topic ‘Why are all ' being changed to \' in the body of emails sent by wp_mail()?’ is closed to new replies.