In WordPress, when I try to insert some special characters into an input field and submit, it will automatically remove them. For example, if I insert <hi
into a text box, WordPress will remove this word since there is a <
character next to it. For example:
As you can see, in this case, WordPress has removed the word <string>
. Following are the HTML and PHP codes I am using on my WordPress page.
<!--HTML code for the form-->
<form action="" method="post" target="_blank">
<input type="text" name="user_input">
<input type="submit" value="Submit">
</form>
<?php
echo "Output: ".stripslashes_deep($_POST['user_input']);
?>
The same thing happens even if I get similar data from a database(with speicial charactors like <string>
) and try to print it into a WordPress page. Is there a way to keep these special characters?