Ready to get started?Download WordPress


Why are all ' being changed to \' in the body of emails sent by wp_mail()? (2 posts)

  1. mtpultz
    Posted 2 years ago #

    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.


  2. mtpultz
    Posted 2 years ago #

    Found a site that had the fix:

    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.

    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

Topic Closed

This topic has been closed to new replies.

About this Topic