Skip to content

Instantly share code, notes, and snippets.

@sairion
Created June 27, 2013 03:39
Show Gist options
  • Save sairion/5873763 to your computer and use it in GitHub Desktop.
Save sairion/5873763 to your computer and use it in GitHub Desktop.
How to remove trailing slashes in WordPress (or PHP)
from
http://fearlessflyer.com/2009/08/getting-rid-of-unwanted-backslashes-in-wordpress-form-input/
<?php
//by using stripslashes_deep, you can dodge trailing slash problems in wp_mail or any kind of form-provided contents
//before PHP 5.3.
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 );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment