This guide will help you set up the right development environment to create blocks and other plugins that extend and modify the Block Editor in WordPress.
A block development environment includes the tools you need on your computer to successfully develop for the Block Editor. The three essential requirements are:
A code editor is used to write code. You can use whichever editor you’re most comfortable with. The key is having a way to open, edit, and save text files.
Node.js and its accompanying development tools allow you to:
- Install and run WordPress packages needed for Block Editor development, such as
- Setup local WordPress environments with
- Use the latest ECMAScript features and write code in ESNext
- Scaffold custom blocks with the
create-block, that streamline the process and are made possible by Node.js development tools.
The recommended Node.js version for block development is Active LTS (Long Term Support). However, there are times when you need to use different versions. A Node.js version manager tool like
nvm is strongly recommended and allows you to change your
node version when required. You will also need Node Package Manager (
npm) and the Node Package eXecute (
npx) to work with some WordPress packages. Both are installed automatically with Node.js.
To be able to use the Node.js tools and packages provided by WordPress for block development, you’ll need to set a proper Node.js runtime environment on your machine. To learn more about how to do this, refer to the links below.
A local WordPress environment (site) provides a controlled, efficient, and secure space for development, allowing you to build and test your code before deploying it to a production site. The same requirements for WordPress apply to local sites.
In the broader WordPress community, many tools are available for setting up a local WordPress environment on your computer. The Block Editor Handbook covers
wp-env, which is open-source and maintained by the WordPress project itself. It’s also the recommended tool for Gutenberg development.
Refer to the Get started with
wp-env guide for setup instructions.
wp-now. This is a lightweight tool powered by WordPress Playground that streamlines setting up a simple local WordPress environment. While still experimental, this tool is great for quickly testing WordPress releases, plugins, and themes.
This list is not exhaustive, but here are several additional options to choose from if you prefer not to use