Skip to content

Sanitize submitted textarea fields like displayed listing content - #3172

Merged
tellyworth merged 4 commits into
trunkfrom
update/submit-form-textarea-sanitization
Nov 6, 2026
Merged

tellyworth merged 4 commits into
trunkfrom
update/submit-form-textarea-sanitization

Conversation

@tellyworth

@tellyworth tellyworth commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Builds on the restricted-shortcodes PR (merge that first; this branch includes its commit).

Changes Proposed in this Pull Request

  • Textarea and editor fields submitted through the frontend forms are stored the way listing content is displayed, unless the submitter can edit job listings.
  • The display pipeline is shared via WP_Job_Manager_Post_Types::restrict_content_html().

Testing Instructions

  • Run tests/php/tests/security/test_class.submit-form-textarea-input.php.
  • Submit descriptions from the frontend form as a subscriber and as an administrator; the administrator's markup is stored as posted.

Release Notes

  • Fix: Sanitize submitted descriptions the way listing content is displayed.

New or Updated Hooks and Templates

  • The job_manager_job_description_allow_shortcodes filter now also runs at submission time, with a null post.

Plugin build for 2c93e07
📦 Download plugin zip
▶️ Open in playground

tellyworth and others added 2 commits November 4, 2026 15:34
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>
Textarea and editor fields submitted through the frontend forms are
stored the way listing content is displayed: unless the submitter can
edit job listings, the content is limited to the listing's allowed
tags, and shortcodes and blocks are kept as the text that was written.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@tellyworth tellyworth added this to the 2.4.10 milestone Nov 6, 2026
@tellyworth tellyworth added the Hooks This change adds or modifies one or more hooks. label Nov 6, 2026
tellyworth and others added 2 commits November 6, 2026 15:56
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 3f7bd96 into trunk Nov 6, 2026
8 checks passed
@tellyworth
tellyworth deleted the update/submit-form-textarea-sanitization branch November 6, 2026 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Hooks This change adds or modifies one or more hooks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant