H
H
HAbRAhabp2015-12-30 13:56:45
PHP
HAbRAhabp, 2015-12-30 13:56:45

WordPress escapes quotes, how to remove them?

WordPress escapes all quotes passed in a GET / POST request. After a little thought, I remembered that there is such a function as magic_quotes_gpc . Checked php.ini, ran the function in the script without connected wordpress, nothing is escaped. It was useful to look at the first thing that caught my eye, I found this in wp-settings.php:

// Add magic quotes and set up $_REQUEST ( $_GET + $_POST )
wp_magic_quotes();

That is, it gives slashes to all _POST and _GET arrays. I don’t want to remove this crutch, stripcslashes cannot be used, because. sometimes lines like this are sent:
$("body").html("<div class=\"container_main\">body</div>");

and js code simply becomes invalid. Is it possible to somehow get the data in its original form or disable this function in a specific file?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Chesnokov, 2015-01-03
@HAbRAhabp

Knowing where, what and how you can get from _GET, write your filter, for example like this:
Let the input string be like this:
You can first replace the characters you don't like \" with \' , and then run the string through stripslashes_deep(). It should turn out:
Ideally, quotes should be changed to their characters&quot;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question