In the Code Block if I type in reversed character, they are encoded to HTML entities:
Input:
Output:
<pre class="wp-block-code"><code>'[] </code></pre>
Meanwhile, if I put them in the custom HTML block, the output characters aren't encode:
Input:
Output:
<code>'[]</code> <code class="'[]"></code> <code><code class="'[]"></code></code> <pre class="wp-block-code"><code>'[]</code></pre>
I wonder why this should be the case? I enable troubleshooting mode and use the Twenty Twenty-One theme.
Related: Why does the custom HTML block not preserve the HTML characters?
In the Code Block if I type in reversed character, they are encoded to HTML entities:
Input:
Output:
<pre class="wp-block-code"><code>'[] </code></pre>
Meanwhile, if I put them in the custom HTML block, the output characters aren't encode:
Input:
Output:
<code>'[]</code> <code class="'[]"></code> <code><code class="'[]"></code></code> <pre class="wp-block-code"><code>'[]</code></pre>
I wonder why this should be the case? I enable troubleshooting mode and use the Twenty Twenty-One theme.
Related: Why does the custom HTML block not preserve the HTML characters?
Share Improve this question asked Jan 7, 2022 at 10:05 OokerOoker 3323 silver badges23 bronze badges 2 |1 Answer
Reset to default 1The Code Block is to display things just as you typed them, so it may encode to ensure no code actually executes.
The HTML block is the reverse - it is to execute code exactly as you typed it, so it doesn't encode.
This is intentional, so you can either show or execute code, depending on your needs. :)
<code>
tag? Because when I put it in the custom html block, the<code>
tag doesn't encode the characters – Ooker Commented Jan 7, 2022 at 11:32