Platform guide
How to Add Minesweeper to a WordPress Blog
WordPress will happily run a Minesweeper board inside a post β the difficulty is that WordPress also has three separate reasons to delete your iframe before it ever goes live. This guide covers the block editor, the classic editor, widgets, and each of those three traps.
- Time needed
- About 2 minutes
- Block used
- Custom HTML
- Slash command
- /html
- Role required
- Admin or Editor
<iframe
src="https://play-minesweeper.games/embed/?size=beginner"
width="316"
height="437"
frameborder="0"
title="Minesweeper Game"
allow="clipboard-write"></iframe>
<p style="font:12px/1.5 Tahoma,'MS Sans Serif',Geneva,sans-serif;color:#555555;margin:6px 0 0;max-width:316px">
<a href="https://play-minesweeper.games/" style="color:#555555">Play Minesweeper</a> β free online Minesweeper, no download
</p> Nothing here needs a plugin, an API key or an account. The board runs on our servers inside the frame; your site just reserves the space for it. The paragraph after the iframe is the credit link β it is plain HTML in your own post, it is how the embed stays free, and it should go in with the rest. Restyle it however you like; a WordPress theme's own link colour usually looks better than the inline grey.
Embedding Minesweeper with the Custom HTML block
-
Copy the full embed code
Open the embed generator, pick a board size and theme, and copy the whole snippet. It is two parts: the iframe that runs the game, and a short credit paragraph underneath it linking back to play-minesweeper.games. WordPress takes both, so paste both.
-
Add a Custom HTML block
In the block editor, put the cursor on an empty paragraph, type /html and press Enter. You can also click the blue + Block Inserter in the top-left corner and search for "Custom HTML". The block appears with an Edit HTML button.
-
Paste the code into the block
Click Edit HTML, paste the whole snippet into the code pane β iframe and credit line together β and check the live preview that renders beside it. Press Update when the board looks right. On older WordPress versions the block toolbar instead has a HTML / Preview toggle you can flip to check your work.
-
Or use the Text tab in the classic editor
If your site still runs the classic editor, switch from the Visual tab to the Text tab at the top-right of the editing box, paste the code there, and save without switching back to Visual β the visual editor rewrites markup it does not recognise and can strip the iframe.
-
Preview on desktop and phone, then publish
Use Preview > Preview in new tab to load the post on a real device. Confirm the board is not clipped by your themeβs content width, then hit Publish or Update.
Why WordPress keeps deleting your iframe
This is the number one reason a game embed fails on WordPress, and it has three separate causes that look identical from the editor.
1. Your user role. WordPress sanitises saved content with
wp_kses() unless the author has the unfiltered_html capability.
Administrators and Editors have it on a standard single-site install. Authors and Contributors
do not, so their <iframe> is silently removed the moment the post is saved.
On a Multisite network, only Super Admins keep the capability β an Administrator of one site in
the network will still lose the tag.
2. WordPress.com's plan restrictions. Hosted WordPress.com sites treat
iframe, script, style, form,
embed and object as premium markup; they require a paid plan with
hosting features activated. On the free plan the Custom HTML block accepts the paste and then
strips it on save. If you are on a free WordPress.com blog, link to the game instead of
embedding it β the link still works fine in a post.
3. The classic editor's Visual tab. Pasting into the Text tab and then clicking back to Visual before saving lets TinyMCE reformat the markup, which frequently mangles or drops iframes. Paste last, save from the Text tab.
Making the board fit your theme
Block themes constrain post content to a fixed content width β commonly 650 to 840 pixels. The generated iframe has hard pixel dimensions, so a board wider than that column will spill out or get clipped on phones. Wrap it so it can scroll instead of breaking the layout:
<div style="max-width:100%;overflow-x:auto;text-align:center">
<iframe src="https://play-minesweeper.games/embed/?size=intermediate"
width="540" height="661" frameborder="0"
title="Minesweeper Game" loading="lazy"></iframe>
<p style="font:12px/1.5 sans-serif;margin:6px auto 0;max-width:540px">
<a href="https://play-minesweeper.games/">Play Minesweeper</a> β free online Minesweeper, no download
</p>
</div> Rough guidance by placement: Beginner 9×9 (316×437) for sidebars and narrow mobile-first themes, Intermediate 16×16 (540×661) for a normal post column, Expert 30×16 (988×661) only inside a full-width or wide alignment group.
In the block editor you can also select the Custom HTML block's parent Group block and set its alignment to Wide width or Full width if your theme supports it, which gives an Expert board room to breathe.
Sidebars, footers and page builders
Widget areas. Appearance > Widgets, add a Custom HTML widget, paste the same snippet. A game in the sidebar is a genuine dwell-time play for a puzzle or gaming blog.
Elementor. Drag in the HTML widget and paste both parts. Do not use the Text Editor widget; it filters tags in the same way the classic editor does.
Divi. Use a Code module rather than a Text module.
AMP. The official AMP plugin converts <iframe> into
<amp-iframe>. AMP requires framed content to be served over HTTPS β which this is β
and refuses to render an iframe placed high in the first viewport unless it is at least 600
pixels tall. Put the board below your opening paragraphs and it validates.
Static site caching and CDNs. Nothing about the embed needs to be regenerated, so full-page caching, Cloudflare and similar are all fine. Only lazy-load rewriting causes trouble, and only when it targets iframes.
WordPress embed questions
- Which WordPress plan do I need to embed a game?
- On a self-hosted WordPress site (wordpress.org software on your own hosting) there is no plan involved β iframes work out of the box for Administrators and Editors. On WordPress.com, tags such as iframe, script, form and embed are only allowed on a paid plan with hosting features enabled; free and entry-level WordPress.com plans strip them when the post is saved.
- My iframe disappears every time I save the post. Why?
- WordPress runs saved content through wp_kses() for any user who lacks the unfiltered_html capability, and that filter removes iframe and script tags. Administrators and Editors have the capability on a single site; on Multisite only Super Admins do, so an Editor on a network install will keep losing the code. Ask an admin to publish the post, or install a plugin that grants the capability.
- Can I add Minesweeper to my WordPress sidebar?
- Yes. Go to Appearance > Widgets, add a Custom HTML widget to the sidebar area, and paste the same snippet. Sidebars are usually 300 to 350 pixels wide, so use the Beginner 9x9 board β the Intermediate board will overflow.
- Do I need a plugin to embed the game?
- No. It is a plain iframe with no JavaScript for your site to load, so the built-in Custom HTML block is enough. Plugins such as Advanced iFrame only help if you need extra behaviour like automatic height matching.
- The game shows as a blank box after I enabled my caching plugin.
- Aggressive optimisation plugins can lazy-load or defer iframes, replacing them with a placeholder that never swaps in. In WP Rocket, LiteSpeed Cache or Autoptimize, add play-minesweeper.games to the lazy-load exclusion list, then clear the cache.
- Will embedding a game slow down my page?
- The iframe loads in its own browser context after your page renders, so it does not block your content. If you want to be strict about it, add loading="lazy" to the iframe tag so the game only downloads when the reader scrolls near it.
Everything on this page starts with a snippet from the generator: a game frame plus a one-line credit link that goes under it. Pick a board size and theme, decide whether to show the optional "Powered by" line inside the game, then copy the code.
Open the Minesweeper embed generator