DEV Community

Kamal
Kamal

Posted on • Originally published at blog.kamalhosen.me on

3 WordPress Plugin Boilerplate

WordPress plugins are a great way to add custom functionality to your site. However, they can also be a great way to add clutter and bloat to your site if you’re not careful. That’s why it’s important to start with a plugin boilerplate. A plugin boilerplate is a set of files and folders that contain the minimum amount of code needed to create a working WordPress plugin.

There are many different ways to set up a WordPress plugin boilerplate. In this post, we’ll take a look at four of the most popular methods

WP CLI

The wp-cli plugin scafold is a command line interface tool that allows you to quickly generate a plugin scaffold. This is a great tool for developers who want to create a new plugin quickly and easily. The plugin scaffold will create all of the necessary files and folders for you, so all you need to do is fill in the code.

wp scaffold plugin my-plugin
Enter fullscreen mode Exit fullscreen mode

Please note that this script must be run within your WordPress plugins directory else it will throw an error. All available commands here

WP Strap

This open-source project offers a well-organized and object-oriented boilerplate for WordPress plugin development and testing. The Boilerplate is based on the Plugin API, Coding Standards, and Documentation Standards and can be installed using Composer. It includes Codeception (unit/acceptance tests), TravisCI (continuous integration), and PHP_CodeSniffer (code style checks).

npx wp-strap plugin
Enter fullscreen mode Exit fullscreen mode

This package includes Composer, Codeception (unit/acceptance testing), PHPCodeSniffer with WordPress Coding Standards to validate your code, TravisCI configuration for automatic testing & continuous integration, and Webpack 5 for front-end development with BabelJS v7, BrowserSync v2, PostCSS v8, and PurgeCSS v3.

WPPB.me

This project was started by Tom McFarlin’s WPPB foundation plugin and is now maintained by Devin Vinson. It provides a simple form for specifying plugin details and generating a zipped folder containing the plugin files.

Top comments (0)