feat: add wp_bootstrap_should_render_template filter for plugin decoupling (v1.0.4)
All checks were successful
Create Release Package / PHP Lint (push) Successful in 1m29s
Create Release Package / Build Release (push) Successful in 1m40s

Allows plugins and child themes to prevent the theme's TemplateController
from rendering specific requests, enabling clean separation of concerns.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-02-11 11:48:08 +01:00
parent e3e9b9f2be
commit b285d75878
5 changed files with 35 additions and 3 deletions

View File

@@ -34,7 +34,7 @@ This project is proudly **"vibe-coded"** using Claude.AI - the entire codebase w
**Note for AI Assistants:** Clean this section after the specific features are done or new releases are made. Effective changes are tracked in `CHANGELOG.md`. Do not add completed versions here - document them in the Session History section at the end of this file.
Current version is **v1.0.2**. See `PLAN.md` for details.
Current version is **v1.0.4**. See `PLAN.md` for details.
## Technical Stack
@@ -193,6 +193,21 @@ Build steps (in order):
## Session History
### Session 12 — v1.0.4 Template Render Filter (2026-02-11)
**Completed:** Added `wp_bootstrap_should_render_template` filter to `TemplateController::render()` for clean plugin/theme separation.
**What was added:**
- New `wp_bootstrap_should_render_template` filter at the top of `TemplateController::render()` — returns `true` by default, but plugins can return `false` to prevent the theme from rendering a request
- Enables the wp-jobroom plugin to handle its own custom post types and routes without the theme's `TemplateController` racing to render first
- Theme remains 100% standalone — the filter is a no-op when no plugin hooks into it
**Key learnings:**
- WordPress `template_redirect` hook priority ordering is the primary mechanism for plugin/theme rendering coordination: plugin Router at priority 5, theme TemplateController at default priority 10
- Adding a simple filter check (`apply_filters('wp_bootstrap_should_render_template', true)`) is the cleanest decoupling mechanism — no cross-project class detection needed
### Session 11 — v1.0.3 Conditional Page Title (2026-02-11)
**Completed:** Made `<h1>` on page template conditional to prevent double headings when plugins provide their own titles.