Learn How to Build JavaScript Plugins for WordPress with Riad Benguella’s Starter Kit/Tutorial

photo credit: Krzysztof Puszczyński

Riad Benguella, the technical lead for phase 2 of the Gutenberg project, has published an educational resource to help WordPress developers get started building JavaScript plugins. The WordPress JavaScript Plugin Starter is unique in that it is built as a tutorial, not just a boilerplate. The GitHub repo contains eight commits that have been structured to explain each step along the way. Benguella designed the repository to answer the following questions:

How do I quickly setup a WordPress environment and how do I bake it into my plugin?

How do I define a WordPress Plugin?

How do I load a simple JavaScript script in WordPress?

How do I bundle my JavaScript files?

How do I use advanced JavaScript features like JSX?

How do I build a production-ready version of my plugin?

How does all this fit together?

Benguella predicts a shift in the WordPress development community, as JavaScript skills become essential for extending core’s rapidly evolving JS-based UI. Plugin architecture is changing to accommodate that.

“Plugin developers are required to use JavaScript more in order to extend the editor,” Benguella said. “Most blocks need to be developed using this technology. The modules Gutenberg provides (Components, data module, i18n, apiFetch…) will also encourage developers to extend other parts of WP-Admin in JavaScript. Instead of writing HTML/CSS screens from scratch and rendering them from the server, developers are able to bootstrap and prototype fully accessible new screens in WP-Admin by composing these components in a small number lines of code.”

Benguella’s WordPress JavaScript Plugin Starter resource demystifies the plugin creation process with detailed explanations of each step throughout the readme file. It’s a valuable resource for PHP developers who are just getting started transitioning into building JavaScript plugins.