Lampwrights Forum

Lampwrights Forum (http://www.lampwrights.com/index.php)
-   PHP (http://www.lampwrights.com/forumdisplay.php?f=4)
-   -   Wordpress Adds Slashes to $_GET, $_POST, $_COOKIE & $_REQUEST (http://www.lampwrights.com/showthread.php?t=106)

Jeff 04-11-2011 03:53 PM

Wordpress Adds Slashes to $_GET, $_POST, $_COOKIE & $_REQUEST
 
For those of you who are making wordpress plugins and themes, you may notice that Wordpress 3.0 now basically runs magic_quotes on $_POST, $_GET, $_REQUEST, and $_COOKIE. I am not sure WHY they are doing this, even PHP has deprecated such behavior but there you have it. I wrote up a little function you can include in your code that will undo this when you call it:

Code:

function remove_wp_magic_quotes()
    {
        $_GET    = stripslashes_deep($_GET);
        $_POST  = stripslashes_deep($_POST);
        $_COOKIE = stripslashes_deep($_COOKIE);
        $_REQUEST = stripslashes_deep($_REQUEST);
    }

Enjoy...


All times are GMT -4. The time now is 03:41 PM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2018, vBulletin Solutions, Inc.