WP Bootstrapper WordPress Plugin

Task Replace the pile of add_action calls every plugin starts with, and give the sites on it one foundation.

Every WordPress plugin starts the same way: a file of add_action calls, growing until nobody can say which of them still fire. WP Bootstrapper is the foundation that replaces that file, and it is published as open source under GPL‑3.0.

Source, issues and releases: github.com/kostyasorokin/wp-bootstrapper

Hooks declared where they are used

A method says what it listens to, in a PHP attribute directly above it, with its priority and argument count. The registration list disappears, and the answer to “what runs on init” becomes a search rather than an act of memory.

The attribute is repeatable, so one method can serve several hooks without being wrapped twice. Discovery is done once by reflection over the source tree and written to a generated PHP file, which is what the following requests read instead of reflecting again.

What is actually deferred

Worth being exact about, because it is easy to claim more than is true. Every hook in the cache is registered on every request — that part is not deferred and could not be, since WordPress has to know a listener exists before it fires.

What is deferred is the object. A class is constructed the first time one of its hooks actually runs, and a class whose hooks never fire on a given request is never instantiated at all. On an admin request that means the front-end classes cost nothing beyond the closure holding their name.

Settings without the boilerplate

An admin page is described rather than assembled: tabs, sections and fields are objects with a field type behind an enum, and the rendering, the registration and the sanitising follow from the description.

The point is not brevity. A settings screen written by hand accumulates a sanitiser per field, and the one that gets forgotten is the one that matters — describing the field instead means it cannot be forgotten.

What comes with it

Beside the foundation there is a set of modules that every site needed anyway, each one written on the same attribute system: hardening, cleaning up the document head, trimming the admin, cookies, cron, users, uploads and the editor.

Integrations for Contact Form 7 and TranslatePress live in a folder of their own, so a site that runs neither carries neither.

Roles

Developer
Konstantin Sorokin

Work done
  • Plugin architecture and PHP development
  • Attribute-driven hook system with reflection and a generated cache
  • Deferred object construction for registered hooks
  • Fluent settings API with tabs, sections and typed fields
  • Site modules: security, head, admin, cookies, cron, users, uploads, editor
  • Contact Form 7 and TranslatePress integrations
  • Documentation and open-source release