Skip to main content

Query API

WordPress Playground exposes a simple API that you can use to configure the Playground in the browser.

It works by passing configuration options as query parameters to the Playground URL. For example, to install the pendant theme, you would use the following URL:

https://playground.wordpress.net/?theme=pendant

You can go ahead and try it out. The Playground will automatically install the theme and log you in as an admin. You may even embed this URL in your website using an <iframe> tag:

<iframe src="https://playground.wordpress.net/?theme=pendant"></iframe>

Available options

OptionDefault ValueDescription
php8.5Loads the specified PHP version. Accepts 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, latest, or next. Use next to preview the next PHP version from the php-src development branch; it is currently supported by the web runtime only.
php-extensionLoads a custom PHP.wasm extension manifest before PHP starts. Accepts absolute, root-relative, or page-relative HTTP(S) URLs. Can be used multiple times.
wplatestLoads the specified WordPress version. Accepts the last three major WordPress versions. As of June 1, 2024, that's 6.3, 6.4, or 6.5. You can also use the generic values latest, nightly, or beta.
blueprint-urlThe URL of the Blueprint that will be used to configure this Playground instance.
networkingyesEnables or disables the networking support for Playground. Accepts yes or no.
pluginInstalls the specified plugin. Use the plugin name from the WordPress Plugins Directory URL. For example, if the URL is https://wordpress.org/plugins/wp-lazy-loading/, the plugin name would be wp-lazy-loading. You can pre-install multiple plugins by saying plugin=coblocks&plugin=wp-lazy-loading&…. Installing a plugin automatically logs the user in as an admin. More than one plugin could be installed, just repeating the plugin attribute on the URL.
themeInstalls the specified theme. Use the theme name from the WordPress Themes Directory URL. For example, if the URL is https://wordpress.org/themes/disco/, the theme name would be disco. Installing a theme automatically logs the user in as an admin. Multiples themes could be installed just repeating the theme attribute on the URL.
url/wp-admin/Load the specified initial WordPress page in this Playground instance.
modebrowser-full-screenDetermines how the WordPress instance is displayed. Either wrapped in a browser UI or full width as a seamless experience. Accepts browser-full-screen, or seamless.
lazyDefer loading the Playground assets until someone clicks on the "Run" button. Does not accept any values. If lazy is added as a URL parameter, loading will be deferred.
loginyesLog the user in as an admin. Accepts yes or no.
multisitenoEnables the WordPress multisite mode. Accepts yes or no.
import-siteImports site files and database from a ZIP file specified by a URL.
import-wxrImports site content from a WXR file specified by a URL. It uses the WordPress Importer plugin, so the default admin user must be logged in.
site-slugSelects which site to load from browser storage. If the specified site does not exist, Playground creates a new browser-saved site with the specified slug unless temporary storage is requested.
storageControls whether the Playground is saved by default. Use storage=temp to create an unsaved temporary Playground that is reset when the page is refreshed or closed.
languageen_USSets the locale for the WordPress instance. This must be used in combination with networking=yes otherwise WordPress won't be able to download translations.
core-prInstalls a specific https://github.com/WordPress/wordpress-develop core PR. Accepts the PR number. For example, core-pr=6883.
gutenberg-prInstalls a specific https://github.com/WordPress/gutenberg PR. Accepts the PR number. For example, gutenberg-pr=65337.
gutenberg-branchInstalls a specific branch from https://github.com/WordPress/gutenberg. Accepts the branch name. For example, gutenberg-branch=trunk.
page-titleCustomizes the browser tab title. Useful for identifying different Playground instances when working with multiple tabs. The parameter is preserved when navigating between sites.
can-saveDefault functionality allows for saving Playgrounds to the user's computer or browser. If you would like to turn off the ability for users to save their Playground, add the ?can-save=no parameter, and options to save will be removed from the UI.
mcpnoStarts the MCP (Model Context Protocol) server bridge, allowing external MCP clients to connect to and control the Playground instance. Accepts yes or no.
mcp-port7999Sets the WebSocket port used by the MCP bridge to communicate with the MCP server. Must be used together with mcp=yes. For example, mcp=yes&mcp-port=8080.
overlayOpens a UI overlay on page load. Currently supports blueprints to open the Blueprint Gallery directly. For example, ?overlay=blueprints. The parameter is removed from the URL when the overlay is closed.

For example, the following code embeds a Playground with a preinstalled Gutenberg plugin and opens the post editor:

<iframe src="https://playground.wordpress.net/?plugin=gutenberg&url=/wp-admin/post-new.php&mode=seamless"> </iframe>

Loading PHP.wasm extensions

Use php-extension to load an external PHP.wasm extension manifest before PHP starts. This is useful for demos that need native extension performance, such as the SQLite Database Integration plugin's wp_mysql_parser extension. You do not need custom JavaScript for this — the Query API turns each parameter into a runtime extension request before Playground boots.

https://playground.wordpress.net/?php=8.5&php-extension=https://wordpress.github.io/sqlite-database-integration/wp_mysql_parser-wasm-extension/latest/manifest.json

Use /latest/manifest.json for a quick demo. Use a pinned manifest from the extension release page when you need a stable URL for tests or documentation.

You can repeat php-extension to load multiple manifests:

https://playground.wordpress.net/?php-extension=https://example.com/one/manifest.json&php-extension=https://example.com/two/manifest.json

The parameter accepts absolute, root-relative, and page-relative manifest URLs:

?php-extension=https://cdn.example.com/wp_mysql_parser/manifest.json
?php-extension=/extensions/wp_mysql_parser/manifest.json
?php-extension=./extensions/wp_mysql_parser/manifest.json

Relative values are resolved against the current Playground page URL. The manifest URL must use HTTP(S) once resolved. file: URLs are rejected in the browser. For local CLI workflows, use the --php-extension flag instead.

CORS policy

To import files from a URL, such as a site zip package or PHP extension manifest and .so artifact, they must be served with the Access-Control-Allow-Origin header set. For reference, see: Cross-Origin Resource Sharing (CORS).

GitHub Export Options

The following additional query parameters may be used to pre-configure the GitHub export form:

  • gh-ensure-auth: If set to yes, Playground will display a modal to ensure the user is authenticated with GitHub before proceeding.
  • ghexport-repo-url: The URL of the GitHub repository to export to.
  • ghexport-pr-action: The action to take when exporting (create or update).
  • ghexport-playground-root: The root directory in the Playground to export from.
  • ghexport-repo-root: The root directory in the repository to export to.
  • ghexport-content-type: The content type of the export (plugin, theme, wp-content, custom-paths).
  • ghexport-plugin: Plugin path. When the content type is plugin, pre-select the plugin to export.
  • ghexport-theme: Theme directory name. When the content type is theme, pre-select the theme to export.
  • ghexport-path: A path relative to ghexport-playground-root. Can be provided multiple times. When the content type is custom-paths, it pre-populates the list of paths to export.
  • ghexport-commit-message: The commit message to use when exporting.
  • ghexport-allow-include-zip: Whether to offer an option to include a zip file in the GitHub export (yes, no). Optional. Defaults to yes.