Explore the WordPress Playground Terminal with the new Dev Tools Dock

WordPress Playground has shipped two new features: an integrated Terminal for PHPPHP PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. https://www.php.net/manual/en/index.php and WP-CLIWP-CLI WP-CLI is the Command Line Interface for WordPress, used to do administrative and development tasks in a programmatic way. The project page is http://wp-cli.org/ https://make.wordpress.org/cli/, and a group for developer tools options on the Dock. The compact Dock keeps the everyday actions in view while giving developers a direct path to the tools for inspecting and changing a site.

From the Terminal, you can inspect content, check configuration, test a WordPress APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways., or make a quick change without setting up a local environment or leaving playground.wordpress.net. It runs against the active Playground, so a command reads or changes the same WordPress site visible behind the panel.

The New group for Developer Tools in the Dock

Visit playground.wordpress.net and wait for WordPress to start. The Dock at the bottom of the screen shows New, Playgrounds, Site Settings, Export, and Dev Tools. In its compact state, it hides the developer-facing buttons to give people exploring WordPress a simpler toolbar.

Select Dev Tools next to Export to expand the Dock. It reveals Blueprint, Database, Terminal, Files, Logs, and Email. Then select Terminal to open the runner for the current site.

The expanded Dock puts Terminal alongside the other developer tools.

Playground remembers whether the developer tools were shown or hidden across page reloads. Collapsing them keeps an unfinished Terminal or Blueprint draft, so you can reopen the tool and continue.

The other new feature is Terminal, which opens with two modes:

  • PHP runs short PHP snippets with WordPress already loaded.
  • WP-CLI runs WordPress command-line commands against the active site.

Each mode keeps its own input, results, and command history, so you can move between PHP and WP-CLI without losing your place.

Explore WordPress with PHP

PHP mode provides a syntax-highlighted editor with line numbers and a few ready-to-run examples. You can select examples such as Versions, Site URLURL A specific web address of a website or web page on the Internet, such as a website’s URL www.wordpress.org, List posts, Create post, or Active plugins, edit the code, and select Run.

PHP mode runs a snippet against the active WordPress site and displays the result in the same panel.

WordPress is loaded for you, and the opening <?php tag is optional. For example, this snippet lists the titles of the site’s posts:

foreach ( get_posts() as $post ) {
	echo $post->post_title . "\n";
}

You can also inspect versions and configuration:

echo 'WordPress ' . get_bloginfo( 'version' ) . "\n";
echo 'PHP ' . phpversion() . "\n";
echo 'Site URL: ' . get_site_url();

Each submission is evaluated independently. Variables from one run are not available in the next run, but changes made through WordPress APIs remain in the active Playground. For example, update_option() changes the site’s database just as it would when called by a pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party..

Use Ctrl+Enter or Command+Enter to run code from the keyboard. If the snippet is incomplete, it remains in the editor so you can finish it. Parse and runtime errors appear with concise messages, including a useful source position when available.

Manage the site with WP-CLI

Switch to WP-CLI when it’s the quickest way to inspect or change WordPress. Try a read-only command first:

wp option get blogname
WP-CLI mode accepts commands with or without the leading wp and shows their output below the prompt.

The leading wp is optional, so option get blogname works too. On the first WP-CLI run, Playground downloads the WP-CLI executable if it is not already available. Later commands reuse it.

Here are a few useful commands to try. Run each line separately:

wp core version
wp plugin list
wp post list --fields=ID,post_title,post_status
wp option get siteurl

You can also create content directly:

wp post create --post_title='Created from the Playground Terminal' --post_status=publish

The result reports Success: Created post followed by its ID. Run wp post list --fields=ID,post_title,post_status again to confirm the title and publish status. To view it in WordPress, close the Terminal and enter /wp-admin/edit.php in the Dock’s address field, then open the post from the Posts screen. Refreshing the welcome page alone will not display the new post. Each time you rerun the create command, it creates another post.

Set up real test scenarios

WP-CLI is especially useful for preparing a test site before you check the result in WordPress. You are building a plugin or want to check how a theme will behave in a specific screen. These examples run in a fresh Playground and use a terminal command to prep the test.

Test a WooCommerce cart and coupon

Start Playground with WooCommerce active. The plugin adds its own wp wc commands, and --user=admin gives them the permissions needed to manage store data. Create a published test product and a 10% coupon running those two commands separately:

wp wc product create --name="Playground Test Mug" --type=simple --status=publish --regular_price=19.99 --sku=playground-test-mug-01 --user=admin
wp wc shop_coupon create --code=PLAYGROUND10 --discount_type=percent --amount=10 --user=admin

Open the shop on the WordPress site, add Playground Test Mug to the cart, then apply PLAYGROUND10 under Add coupons. In a fresh Playground test, the product appeared at $19.99, and the coupon reduced the cart total to $17.99.

The commands create the fixtures; adding to cart and applying the coupon still happen in the browser. See the WooCommerce command reference for other store operations.

Prepare posts for CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. or Themes testing

When a feature needs more than one sample post, generate twelve published posts in one command:

wp post generate --count=12 --post_type=post --post_status=publish

The generated posts appear in Posts. In the Playground test, they also fill the blog’s first page and expose a second page of posts, giving testers content for pagination, sorting, search, or bulk-action checks. See the WP-CLI post generation reference.

For a focused blockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience.-editor smoke test, create a post with saved Paragraph block markup:

wp post create --post_title='Block smoke test' --post_status=publish --post_content='Block smoke test'

Use the post ID reported by the command to open /wp-admin/post.php?post=ID&action=edit, replacing ID with that number. The test post opened as a Paragraph block in the editor. For a plugin block, replace this example with that block’s actual saved markup: markup that does not match the block’s definition can trigger a validation warning. The block markup guide explains the format.

A command runner, not a full shell

The integrated Terminal focuses on PHP and WP-CLI. It is not a general-purpose shell, and it does not provide an interactive TTY.

Pass every required value as part of a WP-CLI command. Commands that wait for interactive input are rejected instead of interpreting unavailable input as an empty value. Long-running interactive commands such as wp shell and wp server are not supported.

This constraint makes browser-based execution more predictable. It also protects a command from unexpectedly changing WordPress after a failed attempt to read from standard input. The same fail-fast behavior now applies to the Blueprint wp-cli step, so Blueprint commands must also provide their required arguments explicitly.

A faster path from question to answer

The Terminal fills the space between clicking through wp-admin and building a local development environment. Plugin developers can check an option or active plugin list while reproducing a bug. Documentation authors and learners can run WordPress PHP examples in context. Contributors can inspect a test site before exporting it or sharing a reproducible Blueprint.

The Terminal arrived in pull request #3808, Add Terminal to the Dock, building on an earlier request to integrate WP-CLI into the Playground website. The Dev Tools Dock update made that growing set of tools easier to show or hide.

Thanks to Alex Kirk for developing the Terminal and to the contributors who built and refined the Dock controls.

Try it and share feedback

Open WordPress Playground, check the new features, and tell us what you think. If you find a bug or have an idea for the workflow, open an issue in the WordPress Playground repository or join the #playground channel in Making WordPress Slack.