Bones Command-Line Interface
This document explains the Bones command-line interface included with WP Bones Boilerplate. It provides helpful commands for plugin development. You can start by running php bones and change the plugin namespace using php bones rename "My First WP Bones Plugin". It highlights the importance of using double quotes for arguments with spaces on Windows. The document also covers the deploy command to create a folder for submitting your plugin to the WordPress.org repository.
Overview
Bones is also the name of the command-line interface included with all our WP Bones Boilerplate. It provides a number of helpful commands for your use while developing your plugin. You will use the Bones command-line interface to start your development. First of all, try the command-line console by running:


Then, you can change the plugin namespace from WPKirk to My First WP Bones Plugin, for example:
Great! You are quite ready to start developing.
Common Commands
deploy
When your plugin is ready, you can use the deploy bones command in order to create a new folder useful to submit your plugin to the wordpress.org repository.
Remember that you can ask for help by using:
Where the deploy goes
The deploy deletes the destination folder and fills it again, so since v2.0.10 it checks the folder first, before anything is built:
- the plugin itself, any folder that contains it (
.., your home) and any folder inside it are always refused,--forceor not; - an existing folder is replaced only when it is empty or holds a previous deploy of this plugin, that is its main file with the same
Plugin Name; - anything else is left alone, and the deploy stops and says so. Pass
--forceif that folder really is yours to replace.
Since v3.3.1 a destination whose parent folders do not exist yet gets them, as mkdir -p would, once those checks have passed. A folder or file the deploy cannot write stops it with Deploy failed: could not write '<path>' and exit status 1.
What the deploy leaves out
Since v2.0.6 the deploy asks your plugin’s own git repository what it ignores and skips it, listing every path it left out. That is how a local POST.md stops travelling to WordPress.org: the file is invisible to git status, so nothing else in a release points at it.
Three directories are never consulted, because your repository’s ignore rules do not describe them: vendor/ is composer’s output and your plugin needs it at runtime, public/ holds what the build has just produced, and storage/ is the runtime directory. Most plugins gitignore all three.
Use --keep-ignored when an ignored file really does belong in the package. If the plugin is not a git repository, nothing is filtered.
Test suites
Since v3.2.0 the deploy leaves your plugin’s tests out of the package:
- the PHP suite, where PHPUnit looks for it:
tests/,phpunit.xml,phpunit.xml.distandphpunit.dist.xml; jest.config.jsandjest.config.json;- every
__tests__folder, and every*.test.*or*.spec.*script (.ts,.tsx,.js,.jsx) outsidevendor/andnode_modules/: the files thejest.config.jswritten bymigrate:to-v2runs, together with the__snapshots__and__mocks__folders Jest keeps beside them.
The last ones matter with --wp, which keeps resources/assets: up to v3.1.0 every Jest test in there went to WordPress.org with the scripts beside it, unless your deploy.php listed it. The cache PHPUnit writes, .phpunit.cache, never shipped, because the deploy skips every file and folder whose name starts with a dot. PHPUnit itself and the rest of your require-dev tree are removed as the next section explains.
If your composer.json loads a file from tests/ through autoload-dev’s files, the deploy stops and names it, rather than produce a plugin that fails as it loads. That only happens when the development autoloader reaches the package, with --keep-dev or with no require-dev package installed: move the file out of autoload-dev, or keep it in the package.
If your plugin really ships one of these paths, take it out of the default list in deploy.php:
Agent instructions
Since v3.3.0 the deploy leaves out the files coding agents read from a repository, wherever they are, vendor/ included:
AGENTS.mdandAGENTS.override.md, read by Codex, Cursor, Copilot and most other agents, andAGENT.md;CLAUDE.mdandCLAUDE.local.md, Claude Code’s, aCLAUDE.mdthat links toAGENTS.mdincluded;GEMINI.md, Gemini CLI’s.
Up to v3.2.0 they shipped. A web server hands out a plugin’s files as they are, so a CLAUDE.md in the package, with whatever it says about your code, could be read at wp-content/plugins/<your-plugin>/CLAUDE.md on every site that installed the plugin. A deploy.php filter was no remedy when the package is built without WordPress, in a Docker build or a CI job, because deploy.php only runs when WordPress is loaded.
Their folders, .claude/, .codex/, .cursor/, .github/ and the like, never shipped: the deploy skips every file and folder whose name starts with a dot.
Composer dev packages
The deploy copies vendor/ as it is on disk, and a working copy normally has the require-dev tree installed — PHPUnit, Brain Monkey and the like. Up to v2.0.6 all of it went into the package, WordPress.org included, unless your deploy.php ran composer install --no-dev itself.
Since v2.0.7, when vendor/composer/installed.json lists dev packages, the deploy runs composer install --no-dev --no-scripts --no-plugins --optimize-autoloader in the deployed copy, against your plugin’s composer.lock. Your working copy is never touched, and --no-scripts keeps post-autoload-dump from renaming namespaces a second time. Without a composer.lock, or without Composer on the machine, the deploy stops rather than ship the dev packages. Pass --keep-dev to package them anyway.
The --wp option will create a deploy folder with the necessary files to submit your plugin to the WordPress repository. For further information, see Before submit to WordPress repository.
--wp
In the mydeploy folder, you will find only the necessary files to run your plugin.
Without the --wp option the developer’s resources/assets folder will be removed.
Customize Deploy
Of course, you may customize the deployment process by editing the deploy.php file. In this file, you can add your own commands to run before and after the deployment. You will also find some actions and filters to customize the deployment process.
For example, you can add any custom command to run before the deployment by using:
Or change the list of skipped files by using:
→ See more about Actions & Filters.
install
The install command is used to install the WP Bones framework. You can use the install command by running:
→ See more about Installing WP Bones.
optimize
The optimize command uses the composer dump-autoload -o command to optimize the autoloader. You can use the optimize command by running:
rename
The rename command is used to rename the plugin namespace. You can use the rename command by running:
Since v2.1.0 the rename writes only the files whose content changes, and leaves binary files alone. Up to v2.0.12 it rewrote every file of the plugin, and a compiled .mo catalogue came out corrupted, because a longer plugin id shifts its strings while the offset table stays put.
→ See more about Naming your Plugin.
require
The require command is used to install third-party packages. You can use the require command by running:
Under the hood the require command uses the composer require command. But it also renames the package name in the composer.json file.
We recommend using this command instead of composer require because by doing so, an automatic renaming will be performed.
tinker
The tinker command is used to open an interactive shell. You can use the tinker command by running:
Now you can run any PHP code
You can also use any WordPress function
A value you return is printed, variables live until the session ends, and an error is shown without closing the shell. The session ends with exit, with Ctrl-D, or when piped input runs out. Before v2.0.10 errors printed nothing, and piped input without a final exit never ended.
update
The update command updates the WP Bones framework and the packages it depends on:
Since v2.1.0 it runs composer update wpbones/wpbones --with-dependencies and exits with Composer’s status. To update every package of your plugin, run composer update.
→ After updating the WP Bones framework, have a look at the Changelog to see what’s new.
→ And you may also check the Core Plugin Files to see if there are any changes.
version
The version command is used to version your plugin. You can use the version command by running:
The above command updates the version everywhere your plugin declares it: the main plugin file, readme.txt, and — since v2.0.6 — package.json and the two root entries of package-lock.json. Each file it changes is listed:
Your dependency tree is not touched: everything from the first "node_modules/" key of the lockfile onwards is left exactly as npm wrote it.
You can see the help by using:
The php bones version command can handle the version starting from the current version of the plugin. You can use the following options:
--major
Increments the major version number. For example, if the current version is 1.0.0, the new version will be 2.0.0.
--minor
Increment the minor version number. For example, if the current version is 1.0.0, the new version will be 1.1.0.
--patch
Increment the patch version number. For example, if the current version is 1.0.0, the new version will be 1.0.1.
You can also use the --pre-patch, --pre-minor, and --pre-major options to increment the version with a prefix. For example, if the current version is 1.0.0, the new version will be 1.0.1-rc.1.
The default prefix is rc. But you can change it by using:
The above command will update the plugin version to 1.0.1-beta.1.
plugin
The plugin command is used to get and check your plugin. You can use the plugin command by running:
You will see the current header of your main plugin file.
Check the help for more options:
--check-header
The --check-header option is used to check the plugin header. You can use the --check-header option by running:
migrate:create
Creates a migration in database/migrations/, named with a Y_m_d_His timestamp and the table, from a stub that creates the table you give it:
See Migrations.
migrate
New in v3.0. Runs the migrations that have not run on this site, in file name order, and lists them. It loads WordPress, so the plugin must sit in wp-content/plugins of a WordPress install. It exits with 1 when a migration fails.
migrate:status
New in v3.0. Lists every migration and whether it ran on this site, with its batch and the plugin version it ran with, and the last failure if there is one.
migrate:to-v3
New in v3.0. Converts a 2.x plugin to the breaking changes of WP Bones 3.0. Run it in the plugin’s source folder (not a deployed copy) after composer update has brought in WP Bones 3.0. It asks for a y first.
- It rewrites the
useline of every file indatabase/migrations/to the 3.0 base class,WPBones\Database\Migration. - It turns every file in
database/seeders/into a migration, and deletes the seeder once its migration parses. See Seeding. - It lists, without changing them, the pages, menus and REST routes that 3.0 gives to administrators only, the POST forms that do not print
$plugin->csrfField(), and the Ajax providers with logged actions and no$nonceHash.
Running it again changes nothing. See the full Migrating to v3 guide.
migrate:to-v2
New in v2.0. Converts a v1.x gulp-based plugin to the v2 webpack infrastructure.
The command removes gulpfile.js and package-lock.json, creates
webpack.config.js, tsconfig.json, .prettierrc, .prettierignore and jest.config.js
from the framework stubs, rewrites package.json scripts to the unified
dev/build/test/format/lint block, drops gulp-era devDependencies, and
installs the v2 set (@wordpress/scripts ^31, typescript, glob,
less-loader, webpack-remove-empty-scripts, @types/react*, and prettier
as wp-prettier). Your resources/assets/ tree is left untouched — your code is preserved.
After migration, run:
See the full Migrating to v2 guide for the end-to-end diff.
Creators
The Bones command console provides a set of commands to create some base classes. For example, you can create a Custom Post Type by using:
Every creator that writes a PHP class takes a class name or Folder/ClassName (make:console takes a class name only, since the kernel loads plugin/Console/Commands/*.php), and the namespace follows the folder: php bones make:controller Shop/Cart writes plugin/Http/Controllers/Shop/Cart.php in …\Http\Controllers\Shop. make:app, below, takes an app name instead.
make:app
New in v2.0. Scaffolds a new React/TypeScript app under
resources/assets/apps/. Webpack auto-discovers the new entry — no
package.json edits needed.
Each generated app is a React 18 component using createRoot from
@wordpress/element and __ from @wordpress/i18n, mounted on a
#<name>-root div. The Text Domain is auto-resolved from your plugin
header.
After scaffolding, add the mount div to your view and enqueue the bundle from your controller:
Customizing the stubs
Every creator fills a stub: a template with placeholders such as {Namespace} and {ClassName}. Since v3.1.0 a stub in your plugin’s stubs/ folder comes first. make:controller reads stubs/controller.stub when it is there, and says so (Using stubs/controller.stub), and the framework’s own otherwise. Start from the framework’s:
stub:publish never replaces a stub that is already in stubs/, since it is usually one you have edited: pass --force to take the framework’s again, and your changes go. deploy leaves the .stub files out of the package.
A published stub no longer follows the framework’s. After composer update wpbones/wpbones, compare yours with vendor/wpbones/wpbones/src/Console/stubs/.
{Namespace} is your plugin’s namespace, {ClassName} the class without its folder, and {Path} the sub-namespace of the folder: \Shop for Shop/Cart, empty for Cart.