Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk3 min

How to Edit HTML in WordPress: A Beginner’s Guide

Use a Custom HTML block for a post or page snippet, Code editor for all its content, and the Site Editor for templates on block themes.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the editing method by where the HTML belongs: use a Custom HTML block for a snippet inside one post or page, the block editor’s Code editor for the full post or page, and Appearance > Editor for site templates when a block theme is active.

Choose the right WordPress HTML editor

What you want to change Use this Where it applies
A snippet within one post or page Custom HTML block The selected location in that post or page
The entire post or page as markup Code editor All content in the open post or page
A template, header, footer, or other site structure Site Editor Available when a block theme is active

These tools have different scopes. Editing a post’s code does not edit its theme template. See WordPress.org’s Custom HTML guide, its Block Editor guide, and documentation for block themes and the Site Editor.

Add HTML to one post or page

For an embed or other self-contained markup that belongs in a particular place in your content, add a Custom HTML block.

  1. Open the post or page in the block editor.
  2. Insert a block using the Block Inserter and choose Custom HTML. Alternatively, type /html in a new paragraph block and press Enter.
  3. Enter or paste your markup into the block. If the editor shows Edit HTML, select it before entering code.
  4. Use the block’s preview to inspect the rendered result, then choose Update to save the post or page.

The block stores its markup in the post content; it is not a place to change a site-wide template. WordPress.org documents the block and its preview in the Custom HTML instructions.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Switch the whole post or page to code view

Use the block editor’s Code editor when you need to inspect or edit the complete content of the open post or page as HTML, rather than adding a single block.

  1. Open the post or page in the block editor.
  2. Open the three-dot Options menu.
  3. Choose Code editor instead of Visual editor.
  4. Edit the post or page markup, then switch back to Visual editor if desired and update the content.

This changes the editing view for that post or page. It does not expose or edit the site’s PHP theme files or block-theme templates. WordPress.org describes this editor option in its Block Editor documentation.

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

Edit templates and site structure

To work on structural areas such as a site header, footer, navigation, or template, use the Site Editor if the site has a block theme active.

  1. In the WordPress dashboard, go to Appearance > Editor.
  2. Open the relevant template or template part and make the structural changes using the available editor controls.
  3. Review the result before saving your changes.

Block themes use blocks for all parts of the site. Classic themes instead use PHP templates and do not provide the same Site Editor template workflow. If Appearance > Editor is unavailable, check which theme is active; the Site Editor is not a general-purpose HTML editor for every WordPress theme. See the official guidance on block themes and the Site Editor.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why WordPress may remove HTML

Some code can be filtered when a user does not have the unfiltered_html capability. WordPress.org’s documentation says that, starting in WordPress 7.0, the Custom HTML block has separate HTML, CSS, and JavaScript panels; the CSS and JavaScript panels require that capability. A role such as Contributor may lack it. In that situation WordPress can sanitize the block with wp_kses() when the post is saved or updated, removing disallowed markup such as <script> or <iframe>.

If code disappears after saving, first check your role, the site’s capability configuration, and the installed WordPress version. This behavior is a permission and security restriction, not necessarily a mistake in your markup. The documented capability behavior is described in the Custom HTML block guide; available controls and permissions can vary by site configuration.

Quick fixes when an edit does not appear

  • The code is in the wrong place: use a Custom HTML block for content within one post or page; use the Site Editor for block-theme structure.
  • The saved result differs from the preview: inspect whether your account has unfiltered_html and whether WordPress sanitized restricted markup on save.
  • You cannot find the Site Editor: confirm that a block theme is active; classic themes use a different template system.
  • You only need to see the full post markup: open Options and select Code editor rather than searching for a theme-editing screen.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.