Title: Custom HTML getting mangled
Last modified: December 2, 2021

---

# Custom HTML getting mangled

 *  Resolved [tabascq](https://wordpress.org/support/users/tabascq/)
 * (@tabascq)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/custom-html-getting-mangled/)
 * Hi there, I am new to WordPress and I am trying to add a custom <div> to a post.
   I am using a custom HTML block and trying to add the following (from code editor
   view):
 *     ```
       <!-- wp:paragraph -->
       <p>bleh</p>
       <!-- /wp:paragraph -->
   
       <!-- wp:html -->
       <div class="foo" foodata="mydata">why</div>
       <!-- /wp:html -->
       ```
   
 * and the rendered page ultimately has the following in it:
 *     ```
       <div class="entry-content">
           <p>bleh why</p>
       </div>
       ```
   
 * What is likely to be responsible for mangling my custom HTML and how do I make
   it stop?
 * FWIW, I am using the Twenty Twenty-One theme with no changes, and I installed
   a few plugins that I have since deactivated/uninstalled in the hopes that this
   would help me understand the problem (it didn’t). My server is running WordPress
   5.8.2.
    -  This topic was modified 4 years, 5 months ago by [tabascq](https://wordpress.org/support/users/tabascq/).
    -  This topic was modified 4 years, 5 months ago by [tabascq](https://wordpress.org/support/users/tabascq/).
      Reason: add WordPress version
    -  This topic was modified 4 years, 5 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
      Reason: Moved to Fixing WordPress, this is not an Everything else WordPress
      topic

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [rickymccallum87](https://wordpress.org/support/users/rickymccallum87/)
 * (@rickymccallum87)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/custom-html-getting-mangled/#post-15125370)
 * I freshly installed WordPress (Twenty Twenty-One with no plugins) and could not
   recreate your issue. Here’s my post content from the front-end.
 *     ```
       <p>Welcome to WordPress. This is your first post. Edit or delete it, then start writing!</p>
   
       <div class="foo" foodata="mydata">why</div>
       ```
   
 * Here’s a similar situation where the problem was resolved by editing the post
   as a user with more capabilities.
    [https://wordpress.org/support/topic/tag-removed-from-custom-html-block/](https://wordpress.org/support/topic/tag-removed-from-custom-html-block/)
 * This could be your solution if you’re running a multisite.
 * >  Note: In WordPress Multisite, only Super Admins have the unfiltered_html capability.
 * [https://wordpress.org/support/article/roles-and-capabilities/#unfiltered_html](https://wordpress.org/support/article/roles-and-capabilities/#unfiltered_html)
 *  Thread Starter [tabascq](https://wordpress.org/support/users/tabascq/)
 * (@tabascq)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/custom-html-getting-mangled/#post-15126682)
 * I appreciate the suggestion, but this does not appear to be my issue at first
   glance. I am editing as an Administrator and I do not think I have Multisite 
   enabled (though, to be honest, I do not know how to tell for certain). Moreover,
   the HTML I get is different from the “similar situation” link you provided. When
   I paste the content from that issue:
 *     ```
       <!-- wp:paragraph -->
       <p>before</p>
       <!-- /wp:paragraph -->
   
       <!-- wp:html -->
       <script>document.write('<div>hello world</div>');</script>
       <!-- /wp:html -->
   
       <!-- wp:paragraph -->
       <p>after</p>
       <!-- /wp:paragraph -->
       ```
   
 * I get even less:
 * `<p>before after</p>`
 *  Thread Starter [tabascq](https://wordpress.org/support/users/tabascq/)
 * (@tabascq)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/custom-html-getting-mangled/#post-15127645)
 * Oho, I think I’ve been tricked by the summary/excerpting feature of a page. My
   blog page has been getting a summary version of the post content, which is smashing
   paragraphs together etc. Knowing this, I managed to find the option in Excerpt
   Settings to turn that off. But thanks for the idea!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Custom HTML getting mangled’ is closed to new replies.

## Tags

 * [strip tags](https://wordpress.org/support/topic-tag/strip-tags/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [tabascq](https://wordpress.org/support/users/tabascq/)
 * Last activity: [4 years, 5 months ago](https://wordpress.org/support/topic/custom-html-getting-mangled/#post-15127645)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
