Custom HTML block doesn’t render as expected on frontend or strips code.
Custom HTML Block Not Working
Key Points: You paste valid HTML — but it either doesn’t render properly or gets stripped entirely.
You drop in an iframe, a script, or some clean HTML into a block — but WordPress refuses to show it. Either it disappears, breaks layout, or vanishes entirely when switching editor modes.
🔍 Typical Problems
- Disallowed tags like
<script>,<iframe>,<style>stripped for safety - Security plugins blocking script output
- Theme CSS overriding HTML structure or margins
🛠️ Your Fix Options
- Use a trusted user role (Editor or Admin) to prevent automatic sanitization
- Insert critical code via theme template or shortcode instead
- Use
unfiltered_htmlcapability — but only for trusted users
🚨 Caution
Never allow raw HTML for contributors or subscribers. What you see is not always what your site renders — especially when filters kick in.