防止WordPress的默认输入清理

每当我从 a<textarea>或 ainput文件中获得输入时,WordPress 都会清理我的输入并转义所有特殊字符。如何禁用此功能?例如,如果我有以下接受 C++ 代码(例如cout<<"hello world";WordPress)的html 代码将其转换为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. 
?>

我使用的是 WordPress 5.7.2 版。任何时候我使用像 , ', " 他们这样的特殊字符都会出现在他们面前。我使用不同的 WordPress 主题尝试过这个,结果仍然相同。如果我用stripcslashes($_POST['mycode'])这个得到这些。但是想知道是否有办法从一开始就阻止 WordPress 这样做。下面显示了我得到的输入和输出的图像。

以上是防止WordPress的默认输入清理的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>