Embed LiveCodes playgrounds in WordPress posts and pages by pasting a URL.
- Registers
livecodes.io(and its versioned subdomains) as a trusted oEmbed provider. This matters: embeds resolved via oEmbed discovery get sandboxed iframes (sandbox="allow-scripts" security="restricted"), which breaks interactive playgrounds. Registered providers are trusted and skip sanitization. - Adds a LiveCodes variation of the core Embed block to the block inserter.
Paste a LiveCodes URL (e.g. a share URL like https://livecodes.io/?x=id/...) on its own
line in the editor. Done.
add_filter( 'livecodes_embed_url_pattern', function () {
return '!^https?://livecodes\.example\.com/.*$!i';
} );
add_filter( 'livecodes_embed_provider_endpoint', function () {
return 'https://livecodes.example.com/oembed';
} );Requires Docker and Node.
npx @wordpress/env start # WordPress at http://localhost:8888 (admin / password)
npx @wordpress/env run cli wp plugin install plugin-check --activate
npx @wordpress/env run cli wp plugin check livecodes-embedZip the plugin excluding everything listed in .distignore:
mkdir -p dist/livecodes-embed
cp livecodes-embed.php editor.js readme.txt LICENSE dist/livecodes-embed/
cd dist && zip -r livecodes-embed.zip livecodes-embedPublishing a GitHub release triggers .github/workflows/deploy.yml, which deploys to
WordPress.org SVN (requires SVN_USERNAME / SVN_PASSWORD repository secrets).
Keep Version in livecodes-embed.php, Stable tag in readme.txt, and the git tag in sync.
MIT