You've already forked wp-bootstrap
fix: decode WordPress title entities before Twig to prevent double-encoding (v1.0.10)
WordPress's get_the_title() pre-encodes & as &. Twig autoescape re-encoded the & in & to &#038;, rendering as literal & in the browser. Wrapped all 6 get_the_title() calls in ContextBuilder with wp_specialchars_decode() so Twig can properly re-encode once. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,12 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [1.0.10] - 2026-02-25
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Title double-encoding in Twig templates** (`inc/Template/ContextBuilder.php`): WordPress's `get_the_title()` pre-encodes `&` as `&`. When passed to Twig with autoescape enabled, the `&` in `&` was escaped again to `&#038;`, rendering as literal `&` in the browser (e.g. "Bewerbungen & Nachrichten" instead of "Bewerbungen & Nachrichten"). Fixed by wrapping all 6 `get_the_title()` calls with `wp_specialchars_decode()` to decode WordPress entities before Twig. Twig autoescape then properly re-encodes `&` → `&`. This is XSS-safe because Twig still escapes all output.
|
||||
|
||||
## [1.0.9] - 2026-02-19
|
||||
|
||||
### Performance
|
||||
|
||||
Reference in New Issue
Block a user