Clicky

How To Display PHP Code Directly in WordPress Posts

If you put php code into a WordPress post the WordPress engine will take that code and parse it. This will remove it from the post and leave you without your code!

Escaping PHP Tags

  • To Escape PHP Replace the question mark in the PHP Tag with <?php
  • and the end tag with ?>
  • This means that WordPress doesn’t see the PHP tag and the html code is outputted to the browser. The Browser then converts the the HTML ASCII code (In this case 63 is a question mark)
  • On another note to display HTML character code without the browser changing it into the correct character. Just enclose it in the following tag <pre></pre>