Skip to content

Keep the text inside shortcodes in restricted listing descriptions - #3163

Merged
tellyworth merged 2 commits into
trunkfrom
fix/keep-text-in-restricted-shortcodes
Nov 6, 2026
Merged

tellyworth merged 2 commits into
trunkfrom
fix/keep-text-in-restricted-shortcodes

Conversation

@tellyworth

@tellyworth tellyworth commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Changes Proposed in this Pull Request

  • Restricted listing descriptions now unwrap shortcodes instead of running strip_shortcodes(): the tags are removed, but the text inside enclosing shortcodes is kept. Escaped [[shortcodes]] remain escaped text.
  • Adds job_manager_unwrap_shortcodes().

Testing Instructions

  • Run tests/php/tests/security/test_class.job-description-shortcodes.php.
  • As a user who can't edit job listings, submit a listing whose description wraps text in an enclosing shortcode; the text should still display.

Release Notes

  • Fix: Keep the text written inside shortcodes when displaying restricted listing descriptions.

Plugin build for 19583a3
📦 Download plugin zip
▶️ Open in playground

When a listing's shortcodes are not expanded, enclosing shortcodes are
now unwrapped - the tags are removed and their inner content is kept,
recursively - instead of removed together with their content. Page
builders wrap the whole description in shortcodes, so removing their
inner content blanked those listings. Self-closing shortcodes are still
removed, and escaped [[shortcode]] text keeps its literal form.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@tellyworth tellyworth added this to the 2.4.10 milestone Nov 6, 2026
substr() can return false before PHP 8, which Psalm rejects for the
preg_replace_callback callable.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@tellyworth
tellyworth merged commit 95cd987 into trunk Nov 6, 2026
8 checks passed
@tellyworth
tellyworth deleted the fix/keep-text-in-restricted-shortcodes branch November 6, 2026 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant