Testing out the WP Playground Interactive Code Block

Update: the Interactive Code block has been deprecated and replaced with the new WordPress Playground Block, so all the examples in this post no longer work. I hope to update the use of this block in the near future.
So if you attended the final keynote at WCEU you would have seen the WP Playground demo video.
I’ve been following WP Playground for some time now, and I was able to meet with the developer behind the project, Adam Zieliński, who showed me the interactive code block, which I had to try out.
Below is the simplest implementation of the block:
What I love about it is that it works like this whether you’re writing in the editor or displaying the code on the front end. So I can test this code and see what it will do before I publish this post.
As far as I can see, it supports anything that PHP supports, even working with classes, and setting types for function or method parameters.
How I wish I had this functionality when I first started blogging about learning PHP!
Leave a Reply