Why can I no longer see HTML blocks in the visual editor?

  • Unknown's avatar

    For parts of my articles, I use a code template that I copy into the code editor. The template includes HTML blocks. In the past, I could see those blocks in the visual editor. About a month or two ago. they became invisible. Now, when I want to move them, I have to go into the code editor and do a cut-and-paste … which is awkward and risks error.

    This is a sample of the HTML blocks:

    <!– wp:html –>
    <a name=”RETURN_001″></a>
    <!– /wp:html –>

    Have I accidentally changed a default setting in Gutenberg?

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    Have you tried Custom HTML Block? That will help you view the HTML code in the editor while having the executed version on the live Page/Post. Here is a GIF reference for you. https://d.pr/i/t6nnBL

    Also see this to learn more: https://wordpress.com/support/wordpress-editor/blocks/custom-html-block/?_gl=1*18vh5e9*_gcl_au*MTM2NDYzNjE2MC4xNzY5OTI3MjA4

    I hope that helps.

  • Unknown's avatar

    Thanks for the effort, but it didn’t help. I tried adding a Custom HTML Block. It remained invisible in the Visual Editor. In the Code Editor, it was identical to the code in my template.

    I created the template by copying the code from several years ago by copying the code of an existing article into Notepad, then removing most of the text of the original article. (Apparently, I had used Custom HTML Blocks when creating the original articles.)

    I’ve been using my template to start articles since 2021, at least. (Didn’t check farther back.) The HTML Blocks appeared when using the visible editor until two or three months ago.

    FWIW, I’m running Windows 11 but, other than regular Microsoft Updates, that hasn’t changed in years.

  • Hi @bahnt,

    Using a Custom HTML block should normally still display the content in the Visual Editor. To understand and investigate it better, could you please share the link to a post or page where this is happening, and (If possible) confirm whether this affects all posts using your template or only certain ones?

    Once I have a link, I can take a closer look at the post structure and see if there’s anything causing the HTML block to appear invisible in the editor.

    Looking forward to your reply.

  • Unknown's avatar

    Here’s a link to a brand new page that I just finished creating by hand. I did not use any template.

  • Unknown's avatar
  • Thanks for getting back to us. Looking at the code you added to the custom HTML block, it doesn’t follow the correct format if you want the link to display on the page.

    Currently, you have <a name=”ENDNOTE_001″></a>. The <a> tag has a name property but no value.

    If you use something like <a name=”ENDNOTE_001″>ENDNOTE_001</a>, it will display as a link, but you should also use the href property to link the tag to a destination URL.

    I hope this helps. Let us know if you have other concerns.

  • Unknown's avatar

    I don’t want ENDNOTE_001 to be a visible link for the reader of the published page or post. I want to be able to see the HTML Block in the Visual Editor of Gutenberg while I’m designing and developing the page or post … so that I can move it up or down to position the bookmark. (It worked that way from the original release until a few months ago … then, changed suddenly. 🥲)

    I had already thought of adding a visible component like the one you suggest for my convenience, then erasing the visible part before releasing it to the public, It’s not as convenient as it was but, if that’s what I’m forced to do I shall.

  • Hi @bahnt, thanks for sticking with this and for explaining your workflow so clearly.

    You didn’t accidentally change a Gutenberg setting. What you’re seeing is the result of how the block editor now handles HTML that produces no visible output.

    The markup you’re using, for example:

    <a name="ENDNOTE_001"></a>

    is valid for creating a bookmark or anchor, but because the <a> tag has no visible content inside it, it renders nothing on the page. In recent versions of Gutenberg, blocks that render nothing are no longer shown as visible or draggable elements in the Visual Editor. The block is still there in the post structure, but the editor doesn’t display a placeholder for it anymore.

    The earlier versions of Gutenberg often did show empty Custom HTML blocks in the visual editor, which made them easier to move around while editing. That behavior wasn’t a documented feature, and it has quietly changed as the editor became stricter about only displaying content that actually renders.

    Regarding the suggestion to use <a name=”ENDNOTE_001″>ENDNOTE_001</a> or an href: adding visible text (or an href) would make the anchor show up in the editor, but it would also make it visible to readers on the published page, which you’ve said you don’t want. So your original approach makes sense for your goal, it just no longer gives you a visual handle in the editor.

    At the moment, there isn’t a built-in way in Gutenberg to have an invisible front-end anchor that still appears as a visible, movable marker in the Visual Editor. The usual workaround is exactly what you mentioned, temporarily adding something visible while editing and removing it before publishing, or placing anchors via the block “HTML Anchor” field instead of Custom HTML.

    I agree this would be a useful editor feature, but for now the behavior you’re seeing is expected and not caused by anything you changed.


  • Unknown's avatar

    Thanks. That explains it. I liked the old way better, but I can work around the new way, You’ve answered my question. Thanks.

  • The topic ‘Why can I no longer see HTML blocks in the visual editor?’ is closed to new replies.