npm install playground-step-library

I have updated my Playground Step Library (which I had written about before)–the tool that allows you to use more advanced steps in WordPress Playground–so that it can now also be used programmatically: It is now an npm package: playground-step-library.

Behind the scenes this actually dominoed into migrating it to TypeScript and restructuring the code so that it now both powers the Web UI and the npm package.

Having those custom steps available now makes even more sense that the Playground CLI is production ready and you can use it for things like testing your WordPress plugin with Playwright, see this presentation Building Automated Tests with WordPress Playground from WordCamp Europe 2025 by my colleague Berislav “Bero” Grigicak.

In this example you can see a blueprint JSON that contains steps setSiteName and addPage that don’t exist in the library of steps of Playground. At the time of writing there are 36 custom steps with the goal of making it easier to do things that can be done with a blueprint already but need some complexity. See in the example below how creating a page can be done with runPHP and wp_insert_post but it’s visually easier with a step addPage.

import PlaygroundStepLibrary from 'playground-step-library';
const compiler = new PlaygroundStepLibrary();

const blueprint = {
steps: [
{
step: 'setSiteName',
sitename: 'My Site',
tagline: 'A WordPress Playground demo'
},
{
step: 'addPage',
title: 'Welcome',
content: '<p>Welcome to my site!</p>'
}
]
};

const compiledBlueprint = compiler.compile(blueprint);
console.log(compiledBlueprint);

Which turns this into a valid blueprint:

{
"steps": [
{
"step": "setSiteOptions",
"options": {
"blogname": "My Site",
"blogdescription": "A WordPress Playground demo"
}
},
{
"step": "runPHP",
"code": "\n<?php require_once '/wordpress/wp-load.php';\n$page_args = array(\n\t'post_type' => 'page',\n\t'post_status' => 'publish',\n\t'post_title' => 'Welcome',\n\t'post_content' => '<p>Welcome to my site!</p>',\n);\n$page_id = wp_insert_post( $page_args );"
}
]
}

You can then pass this blueprint to playground CLI to run it (see other demos by my colleague Fellyph):

import { runCLI, RunCLIServer } from '@wp-playground/cli';
await runCLI({
  command: 'server',
  login: true,
  blueprint: compiledBlueprint
});

You can also conveniently try it out in WordPress Playground with this link (and also view in the Step Library UI).

Finally, in the repo there are a number of examples that you can browse and I created a little screen recording of a few of them:

Happy coding!

WordPress as a Refuge from Algorithms

In a previous post, I have written about how you can use WordPress as your own Mastodon instance with the three plugins ActivityPub, Friends, and Enable Mastodon Apps.

The Friends plugin also provides an RSS/Atom feed parser (and can be extended with more of them) so you that you can automatically receive content from many sources. You can also save posts from around the web using the Post Collection plugin, which also provides a “retrieve full content” for excerpt-only RSS feeds. To read what you’ve saved without distractions, you can then send this to your e-reader.

Because this runs on your WordPress, it means that you don’t have to play by the rules set by others (= the social media platform that hosts you). I am not talking about illegal content or anything similar, but rather avoiding exposure to unsolicited content that is intended solely to keep you addicted to the platform.

Another aspect for which I believe WordPress is excellent is maintaining private blogs for content that you don’t want to put on the public web, such as photos of your children. Or a family wiki, a Wikipedia for your family members. All these are things that I prefer not to expose to algorithms like those used by social media platforms.

Digital Consumption Pyramid, modeled after the Food Pyramid

For our digital consumption, I propose we model this after the food pyramid. Sweets (= the addictive stuff) is on the top, it is ok to consume some, but it should not dominate. Below that, we’d have video games, then time on productive systems without algorithms like your own WordPress, or messaging with your friends. I believe the base should consist of research and reading for gaining knowledge.

This is just my own suggestion that I may need to adjust over time. However, I think it illustrates the point that you should be conscious of your own digital and screen time: Your WordPress can be a place for your own consumption needs, away from algorithms that try to manipulate you.

Yes, it’s harder to set up a WordPress than just creating a social media account. I believe that with Playground and blueprints this will become easier soon. But this little bit of extra work gives you the freedom to not be constantly monitored in order to manipulate you with new content to stay on the platform. Or have your data be used for training AI.

I’ll be talking about the above in more detail this weekend in German at WordCamp Vienna (April 25, 2025 at 10am), and in English at WordCamp Europe (June 7, 2025 at 2pm) in Basel, Switzerland. See you there!