Whenever I get an input from a <textarea>
or an input
filed, WordPress sanitize my input and escape all special characters. How can I disable this feature? For example, if I have the following html code that accept a C++ code such as cout<<"hello world";
WordPress will convert it to cout<<\"hello world\";
.
<!--HTML code-->
<form action="/action.php" method="post">
<input type="text" name="mycode" value="cout<<'hello world';">
<input type="submit" value="Submit">
</form>
.
<?php
//PHP code for action.php file
echo $_POST['mycode'];//This output will have all the special characters escaped
//I need this to give me the original text entered by the user without /s.
?>
I am using WordPress version 5.7.2. Any time I use a special characters like \, ', "
They will get \
in front of them. I have tried this using different WordPress themes and the result is still the same. If I use stripcslashes($_POST['mycode'])
this get ride of these \
. But was wondering if there is a way to stop WordPress from doing this from the start. Following shows an image of the input and output I get.