{"id":11968,"date":"2017-12-22T05:06:44","date_gmt":"2017-12-22T10:06:44","guid":{"rendered":"https:\/\/www.boldgrid.com\/support\/?p=11968"},"modified":"2021-08-12T11:20:05","modified_gmt":"2021-08-12T15:20:05","slug":"how-to-use-the-code-editor-in-the-gutenberg-editor","status":"publish","type":"post","link":"https:\/\/www.boldgrid.com\/support\/wordpress-tutorials\/how-to-use-the-code-editor-in-the-gutenberg-editor\/","title":{"rendered":"How to use the Code Editor in the Gutenberg Editor"},"content":{"rendered":"<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n<?xml encoding=\"utf-8\" ?><html><body><p>The Gutenberg editor gives you a visual interface that makes it easy for you to compose a page or post. However, many people still edit their content using the WordPress code editor. Fortunately, the code editor is still present within the Gutenberg editor. You can edit the entire post or page as code, or you can edit individual blocks as code. We will show you how to use the code editor in the Gutenberg editor using a sample post.<\/p>\n<p><em>Looking for an alternative to the Gutenberg Editor?<\/em> Try our <a href=\"https:\/\/www.boldgrid.com\/wordpress-page-builder-by-boldgrid\">WordPress Page Builder<\/a> that uses a different approach to <a href=\"https:\/\/www.boldgrid.com\/wordpress-page-builder-by-boldgrid\/wordpress-blocks\/\">WordPress Blocks<\/a> to help build your website with ease! Otherwise, here are the steps needed to continue this tutorial using WordPress with the current WordPress Editor:<\/p>\n<h2 id=\"using-the-wordpress-code-editor-to-edit-an-individual-block\">Using the WordPress Code Editor to edit an individual block<\/h2>\n<ol>\n<li>Open the page or post and click on the block that you wish to edit with the code editor. A toolbar will appear above the block.<\/li>\n<li>On the far right you will see 3 vertical dots. <strong>Click on the dots<\/strong>. A pop-up menu will appear. Click on the option labeled <strong>Edit as HTML<\/strong>.<a href=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/edit-block-as-html.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-41660 aligncenter\" src=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/edit-block-as-html.jpg\" alt=\"Edit WordPress Block as HTML\" width=\"500\" height=\"388\" srcset=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/edit-block-as-html.jpg 699w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/edit-block-as-html-300x233.jpg 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/li>\n<li>You will then see the block displayed in code. Make your changes or additions to the block.<br>\n<a href=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/html-editor.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-41662\" src=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/html-editor.jpg\" alt=\"HTML view of WordPress block\" width=\"500\" height=\"364\" srcset=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/html-editor.jpg 634w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/html-editor-300x218.jpg 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/li>\n<li>If you wish to see the block in the visual editor after the changes, simply click on the 3 vertical dots again and then click on option labeled <strong>Edit Visually<\/strong>.<a href=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/edit-visually.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-41663\" src=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/edit-visually.jpg\" alt=\"Edit Block visually in WordPress\" width=\"500\" height=\"409\" srcset=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/edit-visually.jpg 636w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/edit-visually-300x245.jpg 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/li>\n<li>Once you are finished, you will need to click on the <strong>Update<\/strong> or <strong>Publish<\/strong> options in the top right corner of the editor in order to save your changes.<\/li>\n<\/ol>\n<h2 id=\"using-the-code-editor-to-edit-the-entire-post-or-page\">Using the Code Editor to edit the entire post or page<\/h2>\n<ol>\n<li>Open the page or post that you wish to edit.<\/li>\n<li>In the top right hand corner next to the icon that looks like a gear you will see 3 vertical dots. <b>Click on the dots<\/b>.<\/li>\n<li>Here you will see the options for <strong>Visual Editor<\/strong> or <strong>Code Editor<\/strong>. By default, the <strong>Visual Editor<\/strong> is selected. Click on the <strong>Code Editor<\/strong> to place the editor in that mode.<br>\n<a href=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/enable-code-editor-wordpress.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-41664\" src=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/enable-code-editor-wordpress-1024x639.jpg\" alt=\"Enable Code Editor in WordPress\" width=\"1024\" height=\"639\" srcset=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/enable-code-editor-wordpress-1024x639.jpg 1024w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/enable-code-editor-wordpress-300x187.jpg 300w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/enable-code-editor-wordpress-768x479.jpg 768w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/enable-code-editor-wordpress.jpg 1103w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/li>\n<li>Make your changes to the page or post. If you&rsquo;d like to return to the visual editor, click the <strong>Exit code editor<\/strong> link in the upper right of the screen.<br>\n<a href=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/exit-code-editor.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-41665\" src=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/exit-code-editor-1024x608.jpg\" alt=\"Exit Code Editor in WordPress\" width=\"1024\" height=\"608\" srcset=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/exit-code-editor-1024x608.jpg 1024w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/exit-code-editor-300x178.jpg 300w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/exit-code-editor-768x456.jpg 768w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/exit-code-editor.jpg 1429w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/li>\n<li>Click on the <b>Update<\/b> or <b>Publish<\/b> button in the top right hand corner in order to save your changes.<\/li>\n<\/ol>\n<h2 id=\"troubleshooting\">Troubleshooting<\/h2>\n<h3 id=\"why-does-my-code-gets-removed-from-the-wordpress-code-editor\">Why does my code gets removed from the WordPress Code Editor?<\/h3>\n<p>Sometimes code will get removed when switching between visual and code views. This happens when the editor doesn&rsquo;t know what to do with the code &ndash; it can&rsquo;t interpret it. If this happens, it might be easier to use a Custom HTML block.<\/p>\n<p><a href=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/custom-html.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-41585\" src=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/custom-html.jpg\" alt=\"WordPress Custom HTML Block\" width=\"402\" height=\"521\" srcset=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/custom-html.jpg 402w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/custom-html-231x300.jpg 231w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/p>\n<h2 id=\"how-to-edit-other-wordpress-code\">How to Edit Other WordPress Code<\/h2>\n<h3 id=\"how-do-i-edit-widget-html\">How do I edit Widget HTML?<\/h3>\n<p>As of the WordPress 5.8 release, widgets now display as blocks. Navigate to Appearance &gt; Widgets in the dashboard. Hover over the widget you&rsquo;d like to edit and then click the 3 dots that appear on the right side of the toolbar. If it is possible to edit the HTML of that widget, you will see the <strong>Edit as HTML<\/strong> link. Please note that not all widgets will have this option.<\/p>\n<p><a href=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/edit-widget-html.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-41587\" src=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/edit-widget-html-1024x599.jpg\" alt=\"Edit WordPress Widget HTML\" width=\"1024\" height=\"599\" srcset=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/edit-widget-html-1024x599.jpg 1024w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/edit-widget-html-300x175.jpg 300w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/edit-widget-html-768x449.jpg 768w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2017\/12\/edit-widget-html.jpg 1329w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<h3 id=\"where-else-can-i-add-custom-code-in-wordpress\">Where else can I add Custom Code in WordPress?<\/h3>\n<p>If you&rsquo;re adding CSS code to use on more than one page, consider using the Customizer. Any code added to the Custom \/ Additional CSS panel is available to use across the entire site.<\/p>\n<p>There are some types of code will not function if added to a page or post, like tracking codes. These generally need to be in the header or footer. There are <a href=\"https:\/\/wordpress.org\/plugins\/search\/tracking+code\/\" target=\"_blank\" rel=\"noopener\">tracking code plugins<\/a> available to get the code in the correct location.<\/p>\n<h3 id=\"how-do-i-edit-html-in-wordpress-theme-code\">How do I edit HTML in WordPress theme code?<\/h3>\n<p>It is not possible to edit a theme&rsquo;s code from the WordPress editor. You can make changes to a theme from the dashboard by going to Appearance &gt; Theme Editor, but we do not recommend it. If you want to make code changes to a WordPress theme you should use a <a href=\"https:\/\/developer.wordpress.org\/themes\/advanced-topics\/child-themes\/\" target=\"_blank\" rel=\"noopener\">Child Theme<\/a>. Otherwise theme updates could override or break your changes.<\/p>\n<p>This concludes our tutorial on how to use the WordPress Code editor \/ Gutenberg editor. If you wish to learn more about using the WordPress Gutenberg editor, please see our article on <a href=\"https:\/\/www.boldgrid.com\/support\/wordpress-tutorials\/how-to-publish-content-created-with-the-gutenberg-editor\/\">publishing content with the Gutenberg editor<\/a>.<\/p>\n<\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>The Gutenberg editor gives you a visual interface that makes it easy for you to compose a page or post. However, many people still edit their content using the WordPress code editor. Fortunately, the code editor is still present within the Gutenberg editor. You can edit the entire post or page as code, or you [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"bgseo_title":"How to use the Code Editor in the Gutenberg Editor","bgseo_description":"Learn how to use the Code Editor in the Gutenberg Editor.  ","bgseo_robots_index":"index","bgseo_robots_follow":"follow","footnotes":""},"categories":[151],"tags":[691],"class_list":["post-11968","post","type-post","status-publish","format-standard","hentry","category-wordpress-tutorials","tag-gutenberg"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts\/11968","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/comments?post=11968"}],"version-history":[{"count":10,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts\/11968\/revisions"}],"predecessor-version":[{"id":121415,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts\/11968\/revisions\/121415"}],"wp:attachment":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/media?parent=11968"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/categories?post=11968"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/tags?post=11968"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}