Repository navigation
Releases
v3.4.1
Fixes
- The framework loads the plugin's own
Text Domainheader when it loads the translations (#148). Until now it used the literalwp-kirkthatbones renamerewrites to a slug derived from the plugin name, so a plugin whoseText Domaindiffers from that slug had to callload_plugin_textdomain()itself. A header without aText Domainstill falls back to that literal. Domain Pathdefaults tolanguageswhen the header has none (it was an undefined-index notice) and its leading slash, as WordPress documents it, is trimmed.
To update a plugin: composer update wpbones/wpbones.
Full Changelog: v3.4.0...v3.4.1
v3.4.0
What's new
-
β¨ Menu icons for WordPress 7.2 (#146). WordPress 7.2 draws the admin menu with inline SVG icons, and
add_menu_page()now takes the name of a registered icon. Theiconofconfig/menus.phpnow passes these through:- an icon name such as
core-admin/pin, on WordPress 7.2 and later; none(or the olderdiv);- an absolute or protocol-relative URL.
Dashicons classes and
data:URIs work as before, and any other value is still a file in your plugin'spublic/imagesfolder.Up to 3.3.1,
none, a URL and an icon name all became a broken image. To keep a Dashicon on earlier WordPress versions, gate the name:'icon' => function_exists('wp_is_valid_icon_name') ? 'core-admin/pin' : 'dashicons-admin-post',
The menu icon of custom post types already reached
register_post_type()unchanged, so icon names work there with no change. - an icon name such as
Update with composer update wpbones/wpbones.
Full Changelog: v3.3.1...v3.4.0
v3.3.1
Two fixes: a module whose name ends with p or h loads again, and bones deploy no longer says it succeeded when it copied nothing.
Helpers
wpbones_modules()andimport()load the module they are named after (#144, fixes #142, reported by @bardrop). The name went throughrtrim($file, '.php'), and the second argument ofrtrim()is a set of characters, not a suffix: every trailing.,pandhwas stripped, sowpbones_modules('shop')requiredplugin/modules/sho.php,'graph'requiredgra.php,'Help.php'requiredHel.php, each ending in a fatal error. It had been so since the helper arrived in 1.8.0. Now.phpis appended only when the name does not already end with it.
bones
deploycreates a missing destination parent, and a failed copy fails the deploy (#143, fixes #139).php bones deploy /tmp/missing-parent/my-plugincopied nothing: every write failed with a PHP warning, and the deploy still printedβ Deploy completed!and exited with0. The missing parents are now created, once the destination checks have passed, and a folder or file the deploy cannot write stops it withDeploy failed: could not write '<path>'and exit status1; with--create-zipthe staging folder is removed and no zip is written. A.or..after a missing folder is refused, since it would resolve through a link the checks never followed;deploy ../deploy-versionfrom the plugin works as before.- Replacing an existing destination touches only that folder (#143). The folder was emptied through
glob(), so a destination whose name holds[,*,?or{was read as a pattern: replacingx[ab]emptiedxa/andxb/instead. A symlinked folder inside an old destination was followed and its target emptied too. Both are gone: the deploy walks the folder's real entries and unlinks a link without following it.
Upgrading
composer update wpbones/wpbones. Nothing to change.
Docs: Hooks and Modules Β· Where the deploy goes
Full Changelog: v3.3.0...v3.3.1
v3.3.0
A coding agent's notes no longer travel with the plugin: php bones deploy leaves the agent instruction files out of the package by default.
bones
deployleaves the agent instruction files out (#140). Up to 3.2.0 the default skip list namedREADME.mdand theDockerfilebut none of them, and a web server hands out a plugin's files as they are: aCLAUDE.mdin the package, with whatever it says about the code, could be read atwp-content/plugins/<plugin>/CLAUDE.mdon every site that installed the plugin. Adeploy.phpfilter was no remedy when the package is built without WordPress, in a Docker build or a CI job, sincedeploy.phponly runs when WordPress is loaded. Now the package never holds, wherever they are andvendor/included:AGENTS.mdandAGENTS.override.md(Codex, Cursor, Copilot and most others),AGENT.md;CLAUDE.mdandCLAUDE.local.md(Claude Code), aCLAUDE.mdlink toAGENTS.mdtoo;GEMINI.md(Gemini CLI).
- Their folders,
.claude/,.codex/,.cursor/,.github/, never shipped: the deploy skips every dot entry.
Upgrading
composer update wpbones/wpbones. Nothing to change. To ship one of these files anyway, take it out with the wpbones_console_deploy_default_skip_files_folders filter.
Docs: What the deploy leaves out
Full Changelog: v3.2.0...v3.3.0
v3.2.0
A plugin's test suites no longer travel with it: php bones deploy leaves them out of the package by default.
bones
deployleaves the test suites out (#136). Up to 3.1.0 the default skip list named none of them, so a plugin shipped its tests unless itsdeploy.phplisted them, and--wp, which keepsresources/assets, sent every Jest test in there to WordPress.org with the scripts beside it. Now the package never holds:tests/,phpunit.xml,phpunit.xml.distandphpunit.dist.xml;jest.config.jsandjest.config.json;- any
__tests__,__snapshots__or__mocks__folder, or*.test.*/*.spec.*script (.ts,.tsx,.js,.jsx), outsidevendor/andnode_modules/: what thejest.config.jswritten bymigrate:to-v2runs.
- A package that cannot load is not produced. When the copy's Composer autoloader requires a file the deploy left out β
autoload-devnaming a file intests/, with--keep-devor with no dev package to prune β the deploy stops and names it, instead of shipping a plugin that fails on every request.
PHPUnit, Brain Monkey and the rest of require-dev were already removed from the package (2.0.7), and the cache PHPUnit writes never shipped.
Upgrading
composer update wpbones/wpbones. Nothing to change. The test entries in your deploy.php become redundant and can stay. To ship one of these paths anyway, take it out with the wpbones_console_deploy_default_skip_files_folders filter.
Docs: What the deploy leaves out
Full Changelog: v3.1.0...v3.2.0
v3.1.0
A plugin can now keep its own stubs: every make:* command reads stubs/ first, and php bones stub:publish copies the framework's there to start from.
bones
- Your own stubs come first (#133, #134). Up to 3.0.0 every
make:*command read its template fromvendor/wpbones/wpbones/src/Console/stubs, so changing what the generators write meant editingvendor/, and the nextcomposer updateput it back. Now a stub in the plugin'sstubs/folder wins, and the command says so (Using stubs/controller.stub). The placeholders ({Namespace},{ClassName},{Path}and each stub's own) are filled as before. php bones stub:publish [<stub> ...] [--force]copies the framework's stubs intostubs/: all of them, or the ones you name. A stub already there is kept unless you pass--force, since it is usually one you have edited; an unknown name lists the stubs there are and writes nothing.deployleaves them out. The.stubfiles instubs/never reach the package. Astubs/folder that also holds other files keeps them.- A stub found nowhere now stops the command before anything is written.
Upgrading
composer update wpbones/wpbones. Nothing to change: without a stubs/ folder every command writes what it wrote in 3.0.0. A published stub no longer follows the framework's: after an update, compare it with vendor/wpbones/wpbones/src/Console/stubs/, or take the new one with php bones stub:publish <stub> --force (your edits go).
Docs: Customizing the stubs
Full Changelog: v3.0.0...v3.1.0
v3.0.0
WP Bones 3.0 changes what the framework does when a plugin says nothing. The changes are breaking, and php bones migrate:to-v3 converts what it can and lists the rest. Read the upgrade guide before you update: https://wpbones.com/docs/migrating-to-v3
PHP stays 8.1+, React stays 18 (from @wordpress/element), and the build does not change.
π₯ Migrations run once per site (#40, #119, #121)
- When a migration runs:
- each migration runs once per site, in file-name order, and its name is recorded in an option;
- the pending ones run on activation, on the first request after the plugin's
Versionchanges (however the update arrived: dashboard, ZIP, FTP, git, Composer), and withphp bones migrate; - a lock keeps concurrent requests from running them twice;
- a failure stops the run and shows administrators a notice until it runs.
- What 2.x did instead: it re-ran every migration and every seeder on each activation and dashboard update, inside the update request, with the old code still loaded.
- Seeders do not run any more: seed data is a migration.
migrate:to-v3converts the seeders, and one with$runOnceseeds only an empty table, as before. - The base class is
WPBones\Database\Migration. Its constructor has no side effects. The old class still loads, deprecated. - New commands:
php bones migrateandphp bones migrate:status.migrate:create <table>creates the table it is given. plugin/updated.phpruns on the first request after an update, in the new code, with$previousVersion.
π₯ What declares nothing is for administrators (#125)
- Pages and menus: a page of
config/routes.phporpages/, or a menu ofconfig/menus.php, without a capability now needsmanage_options. It wasread(2.1.2), and before that nothing. To keep the old behaviour, declare'capability' => 'read'. - REST routes: a route without a
permission_callbackrefuses every request with WordPress'srest_forbidden. It was public. To keep it public, declare'permission_callback' => '__return_true'.
π₯ Requests that change something carry a nonce (#129)
- Admin pages: every request to a WP Bones admin page that is not a GET or a HEAD carries the plugin's nonce. The form prints it with
$plugin->csrfField(); it can also travel in the query string or in anX-WPBones-Nonceheader. The check runs before anyloadcallback or controller method. Up to 2.x, a form on another site could post to these pages with an administrator's cookies. - Opting out: a page that checks its own nonce says
'csrf' => false. - Ajax: a
loggedaction of a provider without$nonceHashrefuses every request.make:ajaxnow sets$nonceHashfor you. useHTTPPost()returns unslashed values.
π₯ Generated files leave the plugin folder (#128)
- Where they go: compiled Blade views and
single/dailylogs go towp-content/uploads/wpbones/<plugin folder>/, with anindex.phpat every level and a deny-all.htaccess. - Log names carry a hash keyed with
AUTH_SALT, so they cannot be guessed where nginx ignores the.htaccess. - Blade compiles only when a Blade view renders.
- No fallback: when uploads cannot be written, a Blade view throws a
RuntimeExceptionthat says so, and the logs fall back toerror_log(). Storage::delete()is there for anuninstall.php.
β¨ php bones migrate:to-v3
Run it in your plugin's source folder after the update. It converts the migrations and the seeders, then lists for you to review:
- every page, menu and REST route that declares nothing;
- every POST form without
csrfField(); - every Ajax provider without a nonce;
- every second unslash of a
useHTTPPost()value.
It rewrites nothing in that list.
Update
composer require "wpbones/wpbones:^3.0"
php bones migrate:to-v3The 14 boilerplates and their Playground demos are on 3.0. Plugins on ^2.x stay on 2.1.3 until they change their constraint.
Full Changelog: v2.1.3...v3.0.0
v2.1.3
π Security
- The default logger writes no file.
- What was wrong:
"errorlog"is the default, andconfig/plugin.phpdescribes it as writing to WordPress's log only. Everylogger()call also appended to<plugin>/storage/logs/<date>.log, in a folder made0777, which the web server serves as text. - What happens now: it is
error_log()only and makes no folder."single"and"daily"still write where they did, and the defaultstorage/logsfolder now gets anindex.phpand a deny-all.htaccess. (#126)
- What was wrong:
- Compiled Blade views are no longer readable from the web.
- What was wrong: Blade compiled into
<plugin>/.cacheas.bladec, and a direct request returned the compiled PHP of a view. - What happens now: views compile to
.php, so a direct request runs them out of context instead of reading them. The.bladecfiles earlier versions left are removed, and.cacheis made withwp_mkdir_p()(it was0777), with anindex.phpand a deny-all.htaccess. (#126)
- What was wrong: Blade compiled into
WP Bones 3.0 moves both folders out of the plugin.
Update
composer update wpbones/wpbonesThen delete what earlier versions left in storage/logs/ if your plugin logs with the default "errorlog". Those <date>.log files are still in the plugin folder, and the update does not remove log files.
Full Changelog: v2.1.2...v2.1.3
v2.1.2
π Security
- Route and
pages/admin pages check the capability they ask for.- What was wrong: the pages of
config/routes.phpand of thepages/folder are registered with no menu entry, and WordPress lets any logged-in user, a subscriber included, open such a page. Thecapabilitykey the docs and the Routes boilerplate declare was never read. - What happens now: a user without the capability gets WordPress's own 403. The check runs before any
loadcallback or controller method, whatever the HTTP verb. - How to set it: a route reads its
capabilitykey. Apages/class adds a publiccapability()method. - The default stays
read. Every user with a role on the site has it. A user with no role on the site, or a network user who is not a member of it, is now refused. (#123)
- What was wrong: the pages of
- A REST route without a
permission_callbacksays it is public.- What was wrong: the framework filled in
'permission_callback' => '__return_true'without a word, so aRoute::post()with no options was a public write endpoint. - What happens now: the route stays public, as before, and a
_doing_it_wrong()notice names it. WithWP_DEBUGon, it shows as anX-WP-DoingItWrongheader on REST responses. Pass'__return_true'to keep a route public on purpose: from WP Bones 3.0 a route without one will not be public. (#123)
- What was wrong: the framework filled in
π Fixes
- The same pages give WordPress their title. On PHP 8.1 and later, every visit to a route or
pages/page logged astrip_tags(): Passing nulldeprecation fromadmin-header.php. (#123)
Update
composer update wpbones/wpbonesThen give each page route that is not meant for every logged-in user a capability, and each public REST route a permission_callback: Pages Routing, REST API.
Full Changelog: v2.1.1...v2.1.2
v2.1.1
π Fixes
- Activation reads the plugin header. Since #51 the kernel reads the plugin header on
init, and activation comes afterinit: inPlugin::_activation()the slug was empty andVersionwas null, so the options delta wrote to an options row with no name, andplugin/activation.phpsaw noVersion. It now reads the header first. The empty-named row earlier activations left behind is harmless and is not removed. (#120) php bones migrate:create <table>creates<table>. The stub ignored the name and always createdmy_plugin_products. (#120)
Both were found while working on the 3.0 migrations (#40).
Update
composer update wpbones/wpbonesFull Changelog: v2.1.0...v2.1.1