Adam Zieliński, creator of WordPress Playground, announced today that the WordPress Core PR previewer is now live. Playground is an experimental project that uses WebAssembly (WASM) to run WordPress in the browser. It creates a WordPress instance with admin access without having to install PHP, MySQL, or Apache, making it nearly instantaneous to fire up a test site.

Testing pull requests is one of the most exciting use cases for the Playground project. The newly launched WordPress Core PR previewer can be found at playground.wordpress.net/wordpress.html. Users can enter the PR number or the URL.

The PR for for previewing wordpress-develop repository pull pequests adds support for a few query parameters that developers can use to customize how the preview loads:

  • ?pr=5481 – preview that PR
  • ?url=/wp-admin/post-new.php – load that URL in WordPress
  • ?mode=seamless – redirect to a full-screen Playground without the browser chrome and any other extra UI elements

Zieliński identified a couple of known issues with this first implementation that developers should be aware of when working with the previewer: Existing PRs need a rebase to work but new PRs work just fine. Additionally, if you test it out, you will find that downloading WordPress may take a long time, as the bundle is ~45MB. Contributors are working on finding a way to optimize this so that it’s quicker and more efficient to preview PRs. Any problems or bugs can be reported to the Playground repository’s issues.

As part of the Playground roadmap, Zieliński is working on making a pull request previewer for all WordPress projects, not just core, as he outlined in a planning issue:

Previewing WordPress Pull Requests requires either a local development setup or a staging setup.

WordPress developers often use either a staging environment that can only run a single branch at a time, or no staging environment at all. This makes testing and team workflows difficult.

Providing an easy way to preview pull requests using Playground would alleviate that burden, catalyze more reviews across the ecosystem, and make calls for testing easier.

WordPress meta contributors recently implemented a “Live Preview” button for plugins in the official directory but ended up reverting it after many plugins were broken due to inadequate support in the Playground environment. Zieliński and contributors are still refining the live preview experience for plugins hosted on WordPress.org, and are creating a Blueprints API that will be easy for developers to use for customizing their Playground instances.