[wp-trac] [WordPress Trac] #63212: Enhancement: Do not throw PHP notice when file is not a pattern registration file
WordPress Trac
noreply at wordpress.org
Wed Apr 2 09:52:59 UTC 2025
#63212: Enhancement: Do not throw PHP notice when file is not a pattern
registration file
--------------------------+------------------------
Reporter: webmandesign | Owner: joemcgill
Type: enhancement | Status: reviewing
Priority: normal | Milestone: 6.8
Component: Themes | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+------------------------
Comment (by webmandesign):
Replying to [comment:13 poena]:
> Even if the code was updated to exclude one named folder inside
''patterns'' (example: ''helpers''), theme developers that have used
subfolders this way would still need to take action, so it would not
really solve anything.
I agree. Having a special subfolder name to skip is not a valid option
even for me. I'd much prefer something more flexible.
I've updated my [https://github.com/WordPress/wordpress-
develop/pull/8631/files GitHub PR code] and proposing:
1. Adding `get_block_patterns_files` (name is subject to change) filter to
allow theme authors filter out the array of files within `patterns`
directory before they are processed. This way a theme author doing
something non-standard with patterns can manage, while still keeping the
default `patterns` directory functionality intact.
2. I've also added a check whether the pattern file has **both** slug and
title set. If both are empty, then maybe we can assume this is not a
pattern file? Surely, this can be removed if this is "too much".
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63212#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list