WordPress
Embed a game inside an article, a sidebar widget, or a dedicated games page — without a plugin.
You don't need a plugin to embed Playgent in WordPress. The SDK is a single script tag and a <div>, and Gutenberg's Custom HTML block (or the Classic editor's HTML mode) renders both as-is.
Embed in an article
In the Gutenberg editor, add a Custom HTML block where you want the game to appear, then paste:
<div id="playgent-host"></div>
<script src="https://static.playgent.com/player/v2.js"></script>
<script>
Playgent.init({
containerId: "playgent-host",
player: "plyr_acme",
game: "sudoku",
mode: "daily",
});
</script>
Replace plyr_acme with your player ID from Hub. Preview the post — the game renders inside the article exactly where you placed the block.
If you'll embed games on multiple posts, move the <script src=…player/v2.js> tag into your theme's <head> once (via a plugin like Insert Headers and Footers or WPCode) — then editorial only needs to paste the <div> and the Playgent.init call per post.
Dedicated games page
Create a new WordPress page (Pages → Add New) titled "Games" or similar. In a Custom HTML block, mount multiple games or a single player you control with tabs:
<div id="playgent-host"></div>
<div style="display:flex; gap:8px; margin-top:12px;">
<button onclick="player.load({ game: 'sudoku', mode: 'daily' })">Sudoku</button>
<button onclick="player.load({ game: 'wordsearch', mode: 'daily' })">Wordsearch</button>
<button onclick="player.load({ game: 'trivia', mode: 'daily' })">Trivia</button>
</div>
<script src="https://static.playgent.com/player/v2.js"></script>
<script>
const player = Playgent.init({
containerId: "playgent-host",
player: "plyr_acme",
game: "sudoku",
mode: "daily",
});
</script>
player.load() swaps content without re-mounting — see Calling methods for the full surface.
WordPress gotchas
Script stripping for non-admin authors
WordPress strips <script> tags from posts authored by users without the unfiltered_html capability — by default that's only Administrators (and Editors on single-site installs). If your editorial team uses the Author or Contributor role, their Playgent.init script silently disappears on save.
Fix: load the SDK once in the theme <head> (see the tip above), then editors paste only the <div> and a minimal init call — which themes often allow because there's no <script> involved. Or grant the relevant roles the unfiltered_html capability via a role-management plugin if your site policy allows it.
Page caching
WP Super Cache, W3 Total Cache, WP Rocket, and Cloudflare APO cache the rendered HTML. If you bake externalUserId into the inline Playgent.init call, every visitor sees the cached value of whoever was logged in when the page was generated.
Fix: call player.setIdentity() from a separate, non-cached snippet (e.g. an AJAX call to /wp-json/.../me) after the page loads.
Security plugins and firewalls
Wordfence, Sucuri, and similar plugins may block third-party iframes by default. If the game doesn't render, allow these origins:
static.playgent.com(SDK + shell)pgl.playgent.com(leaderboard)
AMP
If your theme serves AMP versions of posts, arbitrary <iframe> and <script> won't render. Either disable AMP for posts containing embeds, or use a per-post AMP exclusion rule — Playgent doesn't ship an <amp-iframe> variant.
Origin allowlist
Before the embed loads, add your WordPress domain (production and staging) to the player's allowed origins in Hub → Configuration → Players. Wildcards like *.acme.com work for multi-subdomain sites.