Make WordPress Core

Opened 7 weeks ago

#64551 new defect (bug)

Fix: Escaped shortcodes are no longer expanded in get_the_excerpt()

Reported by: kashviyadav09's profile kashviyadav09 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

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:

Attachments (1)

get-excerpt.php (651 bytes) - added by kashviyadav09 7 weeks ago.

Download all attachments as: .zip

Change History (1)

Note: See TracTickets for help on using tickets.