The handful of commands we type every day, and the aliases that shorten them. WordPress rewards developers who work with its APIs instead of around them. Almost every problem we have debugged in client projects started with a shortcut that bypassed a core function.

The WordPress way
Register things on the right hook, pass complete arguments, and let core handle the rest. It is more typing up front, but the result survives updates and plays nicely with other plugins.
- Check capabilities before doing anything.
- Verify a nonce on every state-changing request.
- Sanitise input and escape output, always.
- Script test sites with WP-CLI.
Registering it properly
Every endpoint and form needs three things: a capability check, a nonce or equivalent, and sanitisation on the way in with escaping on the way out. Skipping any one of them is how sites get compromised.
Program testing can be used to show the presence of bugs, but never to show their absence!
Edsger W. Dijkstra, Notes on Structured Programming, 1970
Quick takeaway
Use the core API that already exists before writing your own.
Security checklist
Hooks
Attach code at the right moment in the request.
Capabilities
Check what the user may do, not who they are.
WP-CLI
Script every repetitive admin task.
WP-CLI makes all of this faster to test. We script the setup of a fresh site for every experiment so nothing depends on the state of a long-lived development database.
None of this is new, and that is the point. The techniques that last are usually the boring ones that are documented well and supported by the platform itself.
As always, the examples are simplified to fit on a page. The production version has more error handling and logging, but the shape of the code is the same.
Questions, corrections, and war stories are welcome in the comments. Several of our best follow-up posts started as a reader pointing out something we had missed.
We will revisit this in six months with fresh numbers. If the results change, we will update the post and note what changed at the end.
If you try this on your own project, start with one page or one service rather than the whole codebase. A small experiment gives you real numbers to argue with, and it is easy to roll back if the idea does not fit.
We have been running this approach for several months now. The initial setup took about a day, and the ongoing cost is close to zero once the team knows where to look.
Wrapping up
We will revisit this in six months with fresh numbers. If the results change, we will update the post and note what changed at the end.
The quote in the middle is doing a lot of work here, and it earns it.
We have a follow-up on CI in the drafts, stay tuned.
This is exactly the write-up I needed this week. We hit the same wall last sprint.
Is there a repo with the full example? Happy to open a PR with a TypeScript version.
Would love a follow-up on how you test this in CI.
The quote in the middle is doing a lot of work here, and it earns it.
This is exactly the write-up I needed this week. We hit the same wall last sprint.