{"id":11285129,"date":"2019-03-07T10:19:35","date_gmt":"2019-03-07T10:19:35","guid":{"rendered":"https:\/\/wordpress.org\/support\/?post_type=helphub_article&#038;p=11285129"},"modified":"2026-05-20T16:05:55","modified_gmt":"2026-05-20T16:05:55","slug":"custom-html","status":"publish","type":"helphub_article","link":"https:\/\/wordpress.org\/documentation\/article\/custom-html\/","title":{"rendered":"Custom HTML"},"content":{"rendered":"\n<p class=\"has-text-align-right has-small-font-size wp-block-paragraph\"><a href=\"https:\/\/wordpress.org\/documentation\/article\/blocks\/\">Go back to the list of Blocks<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Hypertext Markup Language (HTML)<\/strong>, is language used to describe the semantic content of web pages. This can be added using the&nbsp;custom HTML block. This block allows you to insert your code so you can fine-tune your content.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Starting in WordPress 7.0, the Custom HTML block introduces separate editing panels for HTML, CSS, and JavaScript. The CSS and JavaScript panels are only available to users with the unfiltered_html capability. If a user lacks this capability (for example, a Contributor), WordPress will sanitize the block\u2019s content using the function\u00a0<a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/wp_kses\/\">wp_kses()<\/a>, stripping disallowed tags such as\u00a0<code>&lt;script&gt;<\/code>\u00a0and\u00a0<code>&lt;iframe&gt;<\/code>. In this case, the CSS and JavaScript panels are not shown, and any disallowed markup is removed when the post is saved or updated.<\/p>\n\n\n\n<p class=\"has-text-align-left has-background wp-block-paragraph\" style=\"background-color:#e5f5fa\"><a href=\"https:\/\/wordpress.org\/documentation\/article\/roles-and-capabilities\/\">Learn more about WordPress user roles and capabilities<\/a><\/p>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"886\" style=\"aspect-ratio: 1434 \/ 886;\" width=\"1434\" controls poster=\"https:\/\/wordpress.org\/documentation\/files\/2019\/03\/Screenshot-2026-05-20-at-10.54.05-AM.jpg\" src=\"https:\/\/wordpress.org\/documentation\/files\/2019\/03\/html-block-7-0.mp4\"><\/video><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Add a Custom HTML block<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In order to add a&nbsp;custom HTML block, click on the&nbsp;<strong>Block Inserter<\/strong>&nbsp;icon.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can also type <code>\/html<\/code> and hit enter in a new paragraph block to add one quickly.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"576\" height=\"236\" src=\"https:\/\/wordpress.org\/documentation\/files\/2019\/03\/Screenshot-2026-05-20-at-10.56.23-AM.png\" alt=\"Adding a block with a slash html command\" class=\"wp-image-16367973\" style=\"width:321px;height:auto\" srcset=\"https:\/\/wordpress.org\/documentation\/files\/2019\/03\/Screenshot-2026-05-20-at-10.56.23-AM.png 576w, https:\/\/wordpress.org\/documentation\/files\/2019\/03\/Screenshot-2026-05-20-at-10.56.23-AM-300x123.png 300w\" sizes=\"auto, (max-width: 576px) 100vw, 576px\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-left has-background wp-block-paragraph\" style=\"background-color:#e5f5fa\"><a href=\"https:\/\/wordpress.org\/documentation\/article\/adding-a-new-block\/\">Detailed instructions on adding blocks<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Editing the block<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Once you add the block, click on the Edit HTML button to open the editing modal.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"360\" src=\"https:\/\/wordpress.org\/documentation\/files\/2019\/03\/html-editing-block-1024x360.png\" alt=\"Custom HTML block empty state showing an Edit HTML button\" class=\"wp-image-16367974\" style=\"aspect-ratio:2.8445180317690277;width:561px;height:auto\" srcset=\"https:\/\/wordpress.org\/documentation\/files\/2019\/03\/html-editing-block-1024x360.png 1024w, https:\/\/wordpress.org\/documentation\/files\/2019\/03\/html-editing-block-300x105.png 300w, https:\/\/wordpress.org\/documentation\/files\/2019\/03\/html-editing-block-768x270.png 768w, https:\/\/wordpress.org\/documentation\/files\/2019\/03\/html-editing-block.png 1326w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Enter HTML code and see the preview of your output to the right of the code editor. You can expand the modal to fullscreen the Enable\/disable fullscreen button on the top right of the modal. When you are done entering code, press the Update button.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"605\" src=\"https:\/\/wordpress.org\/documentation\/files\/2019\/03\/html-edit-modal-1024x605.png\" alt=\"Custom HTML block edit state showing the HTML code pane on the left and HTML output preview on the right\" class=\"wp-image-16367975\" style=\"aspect-ratio:1.6926108374384237;width:651px;height:auto\" srcset=\"https:\/\/wordpress.org\/documentation\/files\/2019\/03\/html-edit-modal-1024x605.png 1024w, https:\/\/wordpress.org\/documentation\/files\/2019\/03\/html-edit-modal-300x177.png 300w, https:\/\/wordpress.org\/documentation\/files\/2019\/03\/html-edit-modal-768x454.png 768w, https:\/\/wordpress.org\/documentation\/files\/2019\/03\/html-edit-modal-1536x907.png 1536w, https:\/\/wordpress.org\/documentation\/files\/2019\/03\/html-edit-modal.png 1734w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Block toolbar<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The Custom HTML block has the following options on the block toolbar:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"510\" height=\"124\" src=\"https:\/\/wordpress.org\/documentation\/files\/2019\/03\/html-block-toolbar.png\" alt=\"Custom HTML block toolbar\" class=\"wp-image-16367976\" style=\"aspect-ratio:4.113258426966292;object-fit:cover;width:340px\" srcset=\"https:\/\/wordpress.org\/documentation\/files\/2019\/03\/html-block-toolbar.png 510w, https:\/\/wordpress.org\/documentation\/files\/2019\/03\/html-block-toolbar-300x73.png 300w\" sizes=\"auto, (max-width: 510px) 100vw, 510px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Block moving tools<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The block-moving tools allow you to move the block in the editor. Use the six dots icon to drag and drop the block and place it anywhere on the page. Alternatively, click on the up and down arrows to move the block up or down.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"510\" height=\"124\" src=\"https:\/\/wordpress.org\/documentation\/files\/2019\/03\/html-move-tools.png\" alt=\"Custom HTML block toolbar with block moving tools highlighted\" class=\"wp-image-16367977\" style=\"width:340px\" srcset=\"https:\/\/wordpress.org\/documentation\/files\/2019\/03\/html-move-tools.png 510w, https:\/\/wordpress.org\/documentation\/files\/2019\/03\/html-move-tools-300x73.png 300w\" sizes=\"auto, (max-width: 510px) 100vw, 510px\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-left has-background wp-block-paragraph\" style=\"background-color:#e5f5fa\"><a href=\"https:\/\/wordpress.org\/documentation\/article\/moving-blocks\/\" target=\"_blank\" rel=\"noreferrer noopener\">Get more information about moving a block within the editor<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Edit Code button<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Press this button to make changes to your Custom HTML block code.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">More options<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">These controls give you the option to copy, duplicate, or rename your block.<\/p>\n\n\n\n<p class=\"has-text-align-left has-background wp-block-paragraph\" style=\"background-color:#e5f5fa\"><a href=\"https:\/\/wordpress.org\/documentation\/article\/adding-a-new-block\/\"><\/a><a href=\"https:\/\/wordpress.org\/documentation\/article\/more-options\/\">Read about these and other settings<\/a><\/p>\n\n\n\n<h2 id=\"block-settings-panel\" class=\"wp-block-heading\">Block settings<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">While most blocks have specific options in the editor sidebar in addition to the options found in the block toolbar, the HTML block does not have extra options.<\/p>\n\n\n\n<div id=\"changelog\" class=\"wp-block-group changelog has-background is-layout-flow wp-block-group-is-layout-flow\" style=\"background-color:#dce5ec\">\n<h2 class=\"wp-block-heading has-medium-font-size\">Changelog<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Updated 2026-05-20 (props to @awetz583 @atachibana )\n<ul class=\"wp-block-list\">\n<li>Updated information, video and screenshots for 7.0<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Updated 2026-05-01\n<ul class=\"wp-block-list\">\n<li>Updated formatting and added link to roles and capabilities<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Updated 2025-07-21\n<ul class=\"wp-block-list\">\n<li>Added detail HTML processing<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Updated 2022-11-26\n<ul class=\"wp-block-list\">\n<li>Removed redudant content <\/li>\n\n\n\n<li>Aligned images for mobile view<\/li>\n\n\n\n<li>Added heading<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Updated 2022-04-20\n<ul class=\"wp-block-list\">\n<li>Update screenshots to 5.9<\/li>\n\n\n\n<li>Add More Options section<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Go back to the list of Blocks Hypertext Markup Language (HTML), is language used to describe the semantic content of web pages. This can be added using the&nbsp;custom HTML block. This block allows you to insert your code so you can fine-tune your content.&nbsp; Starting in WordPress 7.0, the Custom HTML block introduces separate editing [&hellip;]<\/p>\n","protected":false},"author":13243985,"featured_media":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false},"category":[80,90],"class_list":["post-11285129","helphub_article","type-helphub_article","status-publish","hentry","category-customization","category-widget-blocks"],"revision_note":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/documentation\/wp-json\/wp\/v2\/articles\/11285129","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/documentation\/wp-json\/wp\/v2\/articles"}],"about":[{"href":"https:\/\/wordpress.org\/documentation\/wp-json\/wp\/v2\/types\/helphub_article"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.org\/documentation\/wp-json\/wp\/v2\/comments?post=11285129"}],"version-history":[{"count":8,"href":"https:\/\/wordpress.org\/documentation\/wp-json\/wp\/v2\/articles\/11285129\/revisions"}],"predecessor-version":[{"id":16367978,"href":"https:\/\/wordpress.org\/documentation\/wp-json\/wp\/v2\/articles\/11285129\/revisions\/16367978"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.org\/documentation\/wp-json\/wporg\/v1\/users\/avillegasn"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/documentation\/wp-json\/wp\/v2\/media?parent=11285129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.org\/documentation\/wp-json\/wp\/v2\/category?post=11285129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}