Atchyut Nagabhairava
Atchyut Nagabhairava

Reputation: 1433

How to insert an HTML code block in a WordPress blog post

I had written a blog post in WordPress and checked its preview before publishing and noticed a strange format change in the HTML code I have added in my blog post, converting (encoding) the < and > characters into their (&lt) and (&gt).

Is there a plugin I can add for displaying the code as it is?

Upvotes: 1

Views: 420

Answers (2)

Sanoajul
Sanoajul

Reputation: 287

I replaced the < character with a special character , and the > character by just to prevent rendering my HTML code on my blog.

Upvotes: 0

Atchyut Nagabhairava
Atchyut Nagabhairava

Reputation: 1433

After a long research and help from my seniors, I got this solution for restricting the WordPress from converting (encoding) the < and > characters into their (&lt) and (&gt) equivalents:

You can use:

<pre class="lang:html decode:true ">
    /* Some HTML code here */
</pre>

Upvotes: 2

Related Questions