Skip to main content

Playground APIs Concepts

WordPress Playground in the browser is all about links and iframes. Regardless of which API you choose, you will use it in one of the following ways:

You can customize WordPress Playground by modifying the https://playground.wordpress.net/ link. You can, for example, create a post, request a specific plugin, or run any PHP code.

To prepare such a link, use either the Query API (easy) or the JSON Blueprints API (medium).

Once it's ready, simply post it on your site. It makes a great "Try it yourself" button in a tutorial, for example.

Embed in an <iframe>

WordPress Playground can be embedded in your app using an <iframe>:

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

To customize that Playground instance, you can:

The JavaScript API gives you the most control, but it is also the least convenient option as it requires loading the Playground Client library.

Careful with the demo site

The site at https://playground.wordpress.net is there to support the community, but there are no guarantees it will continue to work if the traffic grows significantly.

If you need certain availability, you should host your own WordPress Playground.

Browser APIs

The following Playground APIs are available in the browser:

  • Query API enable basic operations using only query parameters
  • Blueprints API give you a great degree of control with a simple JSON file
  • JavaScript API give you full control via a JavaScript client from an npm package

In Node.js

The following Playground APIs are available in Node.js:

These APIs are very similar to their web counterparts, but, unsurprisingly, they are not based or links or iframes.