Title: create Custom HTML block via API
Last modified: May 30, 2024

---

# create Custom HTML block via API

 *  Resolved [dstmalo](https://wordpress.org/support/users/dstmalo/)
 * (@dstmalo)
 * [2 years ago](https://wordpress.org/support/topic/create-custom-html-block-via-api/)
 * Hello. I hope this communique’ finds you in the best of health and spirits.
 * I intend to create new posts via the WordPress REST API. I have thoroughly reviewed
   the API documentation [here](https://developer.wordpress.org/rest-api/reference/posts/).
 * I would like the ability to create Custom HTML blocks via the API. For example,
   consider this page. The map is an iframe that points to an HTML file residing
   in a publicly available directory. The entirety of the Custom HTML code is:
 *     ```wp-block-code
       <div class="container">
       <iframe src="https://bwsb.synology.me/wordpress/files/med_map.html" width="50%" height="400" frameborder="0" allowfullscreen="" class="map"></iframe>
       </div>
       ```
   
 * How can I create the equivalent of this Custom HTML block via the API?
 * I’m flexible about where the Custom HTML block appears in relation to the post
   content. If it would be easier, the code could appear as a comment beneath the
   main post.
 * Thank you for reading my inquiry.
    -  This topic was modified 2 years ago by [James Huff](https://wordpress.org/support/users/macmanx/).
      Reason: redundant link removed
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcreate-custom-html-block-via-api%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [2 years ago](https://wordpress.org/support/topic/create-custom-html-block-via-api/#post-17794657)
 * You would have to surround the code you pass with block editor markers so that
   the editor recognizes it as an HTML code block. Example:
 *     ```wp-block-code
       <!-- wp:html -->
       <div class="container">
       <iframe src="https://bwsb.synology.me/wordpress/files/med_map.html" width="50%" height="400" frameborder="0" allowfullscreen="" class="map"></iframe>
       </div>
       <!-- /wp:html -->
       ```
   
 *  Thread Starter [dstmalo](https://wordpress.org/support/users/dstmalo/)
 * (@dstmalo)
 * [2 years ago](https://wordpress.org/support/topic/create-custom-html-block-via-api/#post-17807613)
 * This solved my problem. Thank you.
 * I notice that the
 *     ```wp-block-code
       <!-- wp:html -->
       ```
   
 * tag “escapes” the rest of the message. Are there other escape sequences like 
   this? Is there are list of wp:xxxx tags somewhere?
 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [2 years ago](https://wordpress.org/support/topic/create-custom-html-block-via-api/#post-17807622)
 * The comments are named as the blocks are called internally. Take a look at the
   list of blocks in the core, where you will also find their names: [https://developer.wordpress.org/block-editor/reference-guides/core-blocks/](https://developer.wordpress.org/block-editor/reference-guides/core-blocks/)–
   Plugins can add further blocks whose names you have to look up there.

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

The topic ‘create Custom HTML block via API’ is closed to new replies.

## Tags

 * [custom html](https://wordpress.org/support/topic-tag/custom-html/)

 * In: [Requests and Feedback](https://wordpress.org/support/forum/requests-and-feedback/)
 * 3 replies
 * 2 participants
 * Last reply from: [threadi](https://wordpress.org/support/users/threadi/)
 * Last activity: [2 years ago](https://wordpress.org/support/topic/create-custom-html-block-via-api/#post-17807622)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
