Free tools Windows power users keep installed

One-click scans. No signup required.

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

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

“Upload an HTML file to WordPress” can mean two different jobs: displaying HTML markup as part of a page, or storing an .html document so visitors can download it. Use the Custom HTML block for rendered content. Use Media → Add New and a File block when the document should remain an uploaded file and be offered as a download.

Choose the result you actually need

WordPress has separate tools for HTML code that belongs in a page and for files that belong in the Media Library. Choosing the wrong route is the most common reason an upload appears not to work.

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.
What you want visitors to receive Correct WordPress route What WordPress creates Important requirements or limits
HTML headings, text, tables, or other markup rendered inside a post or page Block editor → Custom HTML HTML stored in the page content as a block Users without the unfiltered_html capability can have disallowed markup removed; the available HTML, CSS, and JavaScript panels depend on that capability.
An .html document retained as a separate file for visitors to obtain Media → Add New, then a File block or a link to the file URL An attachment with a media URL and a downloadable link The hosting provider’s maximum upload size, filesystem permissions, and WordPress’s allowed MIME types can prevent the upload.

Uploading an HTML document to the Media Library is therefore not the same as turning that document into a WordPress page. The Media Library and File block workflow supplies a file link; the Custom HTML workflow supplies rendered page content.

Method 1: Display HTML inside a WordPress page

Use this method when the code should appear as part of a post or page and should be edited with the WordPress content.

Insert a Custom HTML block

  1. Sign in to the WordPress dashboard and open the post or page you want to edit.
  2. Select the Block Inserter (+).
  3. Search for Custom HTML and insert that block. In a new paragraph, you can also type /html and press Enter to insert it.
  4. Enter or paste the markup in the block’s HTML editor. For example, ordinary page markup can contain elements such as <section>, <h2>, <p>, and links.
  5. Use the block’s preview to check how WordPress renders the output.
  6. Select Update to save the page or post.

The Custom HTML block is the editor route for fine-tuning content with your own markup. It does not create a separately addressable .html attachment in the Media Library.

Understand the HTML, CSS, and JavaScript panels

Starting with WordPress 7.0, the Custom HTML block has separate panels for HTML, CSS, and JavaScript. The CSS and JavaScript panels are available only to users who have the unfiltered_html capability.

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

For a user without that capability, WordPress sanitizes the block when it is saved or updated with wp_kses(). Disallowed elements can disappear; the documented examples include <script> and <iframe>. If your code is visible while editing but vanishes after selecting Update, check the account’s capability rather than repeatedly pasting the same code.

  • Ask a site administrator to confirm whether your account has unfiltered_html.
  • Have the administrator review any JavaScript or iframe before granting that capability or changing the site’s content policy.
  • Keep markup that does not require those elements in the HTML panel so it can be saved under the site’s normal sanitization rules.

Method 2: Upload an .html document as a downloadable file

Use this route when you already have a complete HTML document and want visitors to obtain that file rather than merge its markup into a page.

Upload through the Media Library

  1. From the dashboard, open Media → Add New. You can also use the upload control in the Media Library.
  2. Drag the .html file into the upload area, or select Select Files and choose it from your computer.
  3. If the multi-file uploader does not work, use the Browser Uploader fallback shown by WordPress.
  4. After the upload succeeds, open the attachment details.
  5. Copy the read-only File URL displayed in the attachment details. Keep the complete URL; it is the address you can link to from a page, post, menu, or other permitted location.

Put the file link on a page

  1. Open the target page in the block editor.
  2. Insert a File block.
  3. Upload the document from the block, select the copy already in the Media Library, or use the file URL you copied from the attachment details.
  4. Save the page with Update.

The File block is designed to provide a link to a downloadable file. This workflow keeps the document as an attachment; it does not import the document’s headings, styles, or scripts into the surrounding WordPress page.

Why WordPress may reject an HTML upload

“This file type is not allowed”

WordPress may block the .html extension for security reasons. A plugin setting that appears to permit the extension does not necessarily override every WordPress or hosting restriction. If the Media Library refuses the file, the site administrator can investigate a controlled MIME-type change or a file-type plugin.

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

That change should be deliberate and administrator-controlled. Allowing an additional HTML upload type changes what users can place in the site’s media storage and increases the need to review who can upload files and what those files contain. Do not ask an ordinary editor to bypass the restriction by renaming the extension or changing server settings without approval.

The upload is larger than the limit

The Media → Add New screen displays the maximum upload size configured by the hosting provider. If WordPress reports that the file is too large, compare the file size with that displayed limit. A higher limit requires a change in the host or server configuration; it is not fixed by choosing a different block in the editor.

If you cannot change the hosting configuration, reduce the document’s size only when doing so preserves its purpose, or place the already-hosted file behind an external link if the site’s permissions and content requirements allow that approach.

Permission denied or an upload-directory error

Media uploads depend on the web server being able to write to the WordPress installation’s media location. WordPress documentation identifies correct permissions for the wp-content directory as a prerequisite that may need attention.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Record the exact error shown by WordPress.
  • Ask the hosting administrator to check the filesystem configuration and the permissions on wp-content.
  • Do not broadly loosen permissions as a first response; have the host correct the affected directory using its normal security policy.

Scripts or iframes disappear after saving

This symptom normally points to content sanitization. Confirm whether the editing account has unfiltered_html. Users without that capability can have disallowed tags removed by wp_kses() when the Custom HTML block is saved or updated. An administrator should decide whether the markup is necessary and whether granting the capability is appropriate for that user.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Security and permissions decisions

HTML is executable in a browser when it contains active elements, so the two workflows have different security implications. A Custom HTML block can contain scripts or iframes only when the account and site policy permit them. An HTML document accepted into the Media Library is a new file type that the site must store and serve. Both cases require access control, not just a successful upload.

  • Use the narrowest capability: editors who only need headings and links do not need permission to save arbitrary scripts.
  • Review active markup: an administrator should inspect scripts, iframes, and external destinations before allowing them.
  • Keep MIME changes intentional: permitting .html uploads should be a site-owner decision, especially on a site with multiple contributors.
  • Separate presentation from attachments: use Custom HTML for content that belongs in the page and the Media Library for a file that should remain a file.

When an external file is the better option

If the HTML document is already hosted elsewhere, you may not need a Media Library upload. Add an external link, or use an embed only when the target content and your site’s permissions support it. Confirm that the external location will remain available and that linking to it is permitted before removing the upload step. If the document must be controlled through your WordPress media records, retain the local attachment instead.

A practical decision checklist

  • Do you want visitors to see the markup as part of a WordPress page? Insert a Custom HTML block.
  • Do you want visitors to obtain a separate .html document? Upload it under Media → Add New, copy its File URL, and provide it with a File block or link.
  • Will the code require JavaScript or an iframe? Check the user’s unfiltered_html capability and obtain administrator review.
  • Was the file rejected as an unallowed type? Have an administrator evaluate a controlled MIME-type change or file-type plugin.
  • Was it rejected for size? Compare it with the maximum upload size shown on the Media screen and contact the hosting provider if the limit must change.
  • Did WordPress report a permission or upload-directory problem? Have the host check the wp-content filesystem configuration.
  • Is the file already hosted and only needs a link? Use an external link when the destination and permissions are reliable.

What “success” looks like

For rendered content, the Custom HTML block shows the expected preview and remains in the page after you select Update. For a downloadable document, the Media Library contains the attachment, its details expose a File URL, and the page’s File block points visitors to that URL. If either result fails, troubleshoot the specific restriction—capability, MIME type, upload size, or filesystem permissions—instead of switching between the two workflows.

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

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.