0

I want to allow users to send code in comments, but WordPress filter that. How can I do this?

UPDATE:

for example:

I want to send this code snippet in comments, for reply my user:

<code>
    <script>
        alert('booooooom');
    </script>
</code>

If this code sends by admin, cause to show browser alert. and if the user sends it, filtered by Wordpress.

  • Please be more specific. Edit your question to tell us what sort of code you want to allow — HTML, PHP, JS, Java, …? – Pat J Nov 17 '17 at 22:54
  • I understood the question on my first read of it. And the answer is what he wants. – Rick Hellewell Nov 18 '17 at 2:26
3

WordPress allows it by default ( of course, plugins or theme can change that ). The code should be wrapped in <code></code>, like this:

<code>
global $var;
echo $var;
</code>
  • Thank you, it does not work! and the theme was written by my self. – Arshen Nov 19 '17 at 8:02
  • What about plugins? It works on all my sites. – Frank P. Walentynowicz Nov 19 '17 at 15:43
  • I installed this plugin and it works. "HTML Code Comments by Ludovic Scribe" – Arshen Nov 20 '17 at 16:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.