[wp-trac] [WordPress Trac] #64551: Fix: Escaped shortcodes are no longer expanded in get_the_excerpt()
WordPress Trac
noreply at wordpress.org
Sun Jan 25 15:15:30 UTC 2026
#64551: Fix: Escaped shortcodes are no longer expanded in get_the_excerpt()
---------------------------+-----------------------------
Reporter: kashviyadav09 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords:
Focuses: |
---------------------------+-----------------------------
Trac Ticket: https://core.trac.wordpress.org/ticket/12345
### Description
This pull request fixes an issue where escaped shortcodes were being
expanded in `get_the_excerpt()`.
Previously, shortcodes wrapped in escaping functions (like `\[shortcode]`)
were still processed and rendered, which is not the expected behavior.
With this patch, escaped shortcodes are preserved as plain text in
excerpts, ensuring consistency and preventing unexpected content output.
### Changes Made
- Updated `get_the_excerpt()` logic to respect escaped shortcodes
- Added automated PHPUnit tests to cover this scenario
- Ensured backward compatibility with existing excerpts
### Testing
- Added tests in `tests/phpunit/tests/shortcodes/` to verify escaped
shortcodes remain unexpanded
- Run PHPUnit to confirm all tests pass:
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64551>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list