Installing Block-based themes with WPCLI

After some of the great sessions at WordCamp US, I was inspired to learn more about some of the block-based themes found on

The quickest way to view the published block-based themes is to browse the “Full site editing” tag of themes on

But what if we want a way to quickly download and browse the code of those themes on our own machine?

Listing WordPress themes from the CLI

Examining the requests made from the above page, I noticed that the main content is generated from the response to a call to the /themes/info endpoint of

A screenshot of investigating the requests made by

Exploring that endpoint a bit with restclient.el package in Emacs showed that there’s an easy way to get the theme slugs!

A screenshot of exploring the endpoint.

Install all Block-themes with curl, jq, and wpcli

So we have a URL, and if we have jq installed, then we can pipe our way to installing all of the block-themes!

curl\?action\=query_themes\&request%5Btag%5D%5B%5D\=full-site-editing\&request%5Bper_page%5D\=50 | jq -r '.themes[].slug' | xargs wp theme install
A screenshot of the script used to download and install all block-based themes.

Once those are downloaded, it’s just a matter of listing the themes and activating one!

A screenshot of activating and listing the themes using WPCLI.