The WordPress Developer’s Guide to Documentation That Doesn’t Suck

4 min read

Look, we’ve all been there. You inherit a WordPress site with 47 plugins, custom post types scattered across three different plugins, and a functions.php file that looks like it was written during an energy drink binge. No documentation in sight. Let’s break this cycle.

note: this article targets developer-oriented documentation. I talk about client-side documentation in a different article.

Why Documentation Matters

Someday, you’re going to die (or have a less dramatic relationship to the project at hand). I’ve inherited projects from developers who had a less-than-graceful finish. One time I took over a project because the lead dev had a stroke, and so they weren’t able to onboard me. I try to keep this in mind as I work on a project with the goal of “If I were to be replaced tomorrow, my replacement would be able to continue where I left off.”

Even if you’re not working within a team setup, good documentation helps you clarify to yourself why you’re making the decisions you are. Since some of my clients can go years without engaging me, this documentation ends up being a good reference for myself when I need to remodel and build out new features and I don’t remember why I made the decisions I did.

WordPress projects are particularly vulnerable to documentation debt because of their long lifecycles and the ecosystem’s rapid evolution. That plugin you’re using might be abandoned next year, that theme framework might get a breaking update, and that clever hack you used to modify WooCommerce? Future you will have no idea why you did that.

Make Documentation a Non-Negotiable Habit

Stop treating documentation as post-project cleanup. In WordPress development, document:

  • Custom hooks and filters (usage examples are mandatory)
  • Plugin dependencies and their minimum versions
  • Custom post type relationships and their business logic
  • Theme customizer modifications
  • ACF field groups and their purposes
  • Database modifications beyond standard WordPress tables

PRO TIP: Create a docs folder in your theme/plugin root. Add it to your project template. Make it as natural as having an inc folder.

Standardize to Scale with the WordPress Ecosystem

For WordPress projects, standardize documentation for:

  • Environment requirements (PHP versions, MySQL settings, required plugins)
  • Build processes (especially for themes using SASS/webpack)
  • Custom endpoint documentation (for headless setups)
  • Database migrations and seed data
  • Multisite configurations

MUST HAVE: For your themes and plugins, create a CHANGELOG.md that follows WordPress version numbering conventions. A changelog is a file which contains a curated, chronologically ordered list of notable changes for each version of a project. It makes it easier for users and contributors to see precisely what notable changes have been made between each release (or version) of the project. Learn more at Keep a Changelog.

Document the Weird Stuff: Focus on Quality

In WordPress, prioritize documenting the unusual and complex:

  • Custom table queries that bypass WordPress functions
  • Plugin overrides and hooks
  • Performance optimizations
  • Security modifications
  • Third-party API integrations
  • Complex SQL queries

Integrate Documentation Seamlessly into Your Workflow

Make documentation a natural part of your workflow by:

  • Using PHPDoc blocks for custom functions (especially those that hook into WordPress core)
  • Writing Git commit messages that reference documentation updates
  • Implementing pull request templates that include documentation requirements
  • Adding inline comments for complex WordPress hooks

Visuals That Speak Louder Than Words

For WordPress projects, prioritize visual documentation like:

  • Database relationship diagrams (especially for custom post types)
  • Admin panel customization screenshots
  • Plugin dependency flowcharts
  • Cache flow diagrams
  • Authentication flow diagrams

Tools That Turbocharge WordPress Documentation

Consider using these WordPress-specific documentation tools:

  • WPDocGen is a tool by Dario Curvino to automatically extract data about the actionsfilters and shortcodes of your WordPress theme or plugin.
  • dbdiagram.io for custom post type diagrams
  • README generator for WordPress plugins
  • Mark your must-have plugins in composer.json with detailed comments

KEY POINT: Store sensitive configuration details in .env files and document their required variables in .env.example.

Make Documentation a Team Sport

Encourage knowledge sharing among your team by:

  • Maintaining a team wiki for common hooks and filters
  • Documenting frequent plugin conflicts and their solutions
  • Keeping a shared database of useful WP-CLI commands
  • Documenting your team’s preferred ways of handling common WordPress customizations

The README.md Essentials

Every WordPress project README should include:

- Required PHP version
- Required MySQL version
- Plugin dependencies (with versions)
- Build process commands
- Development environment setup
- Custom post types overview
- Database modifications
- Deployment process
- Cache invalidation strategy
- Testing instruction

WordPress-Specific Considerations

Don’t forget to document:

  • Your deployment strategy (especially handling media uploads and database syncing)
  • A security.md file documenting custom hardening measures
  • A performance.md detailing caching strategies and optimization decisions

Final Thoughts

Good documentation isn’t about writing novels—it’s about ensuring your fellow developers (and your future self) don’t need a detective’s license to make sense of your work. This prevents 3 AM emergency calls because production broke and nobody knows why. Let’s raise the bar and make it a standard practice, not an afterthought.