Pattern directory: tidy output escaping and query handling - #766
Merged
Conversation
Small consistency pass across the directory plugin and theme: - Use context-appropriate escaping helpers (esc_url/esc_html/esc_attr) for link, content, and attribute output in the admin flag/pattern row actions, theme shortcodes, and a couple of block templates. - Normalize the pending-flags query ordering to known columns and directions. - Constrain the pattern REST query's block filter to well-formed block names. - Align the basic-text translation parser's replacement handling with the heading and paragraph parsers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…rowing - Align the allowed_blocks validation with WordPress's block-name grammar (^[a-z0-9-]+/[a-z0-9-]+$) so names starting with a digit or hyphen aren't dropped. - Keep building the meta_query when the parameter was supplied, so a list that filters down to nothing narrows results instead of returning everything. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
obenland
force-pushed
the
pattern-directory/tidy-escaping-and-query
branch
from
August 31, 2026 15:53
f320c8e to
3f724f3
Compare
…ases - allowed_blocks: when every supplied name is invalid, match no patterns explicitly instead of emitting a degenerate '^((),?)+$' regex (which would match empty-meta rows and can error on older regex engines). - Pending-flags query: guard orderby/order against non-string (array) values so multi-column sort input can't trigger a string-conversion warning. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A small consistency pass across the pattern directory plugin and the 2024 theme. No behavior changes for normal use — mostly making output escaping and a couple of query paths match the conventions used elsewhere in the codebase.
Changes
Output escaping (context-appropriate helpers)
esc_url()for link hrefs (wereesc_attr()or unescaped).pattern_edit_link,pattern_draft_link) returnesc_url()'d URLs.report-patternblock: term name printed as content usesesc_html().pattern-previewframe: iframetitleattribute usesesc_attr_e().status-noticeblock: unlisted reason runs throughwp_kses_post(), matching the equivalent REST field.esc_html()and the heading tag is constrained toh1–h6.Query handling
orderby/ordernormalized to known columns andASC/DESC.allowed_blocksfilter is limited to well-formed block names before it's used.Translations
BasicTextparser aligns its replacement handling with theHeading/Paragraphparsers.Notes
phpcspasses clean (0 errors / 0 warnings) on all changed files;php -lclean.report-patternandpattern-previewrender.phpfiles are served frombuild/, so anpm run build:themeis needed for those two to take effect at runtime.