Lampwrights Forum > Linux, Apache, MySQL, PHP > PHP

Reply
 
Thread Tools
04-11-2011, 02:53 PM   #1
Jeff
Administrator
 
Jeff's Avatar
 
Join Date: Jul 2010
Posts: 402
Rep Power: 10
Jeff is getting browny points
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...
Jeff is offline   Reply With Quote

Reply

Tags

other php

,

php

,

php examples

,

php how-to


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -4. The time now is 09:15 AM.


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