[wp-trac] [WordPress Trac] #62140: Relax restrictions around registration of block metadata collections
WordPress Trac
noreply at wordpress.org
Thu Jan 16 17:58:13 UTC 2025
#62140: Relax restrictions around registration of block metadata collections
--------------------------------------+---------------------
Reporter: flixos90 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.7.2
Component: Editor | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+---------------------
Changes (by flixos90):
* keywords: has-patch => has-patch has-unit-tests
Comment:
I thought about this further and came up with a better solution, where the
list of collection root directories is only used as a denylist. To take
the example of `WP_PLUGIN_DIR`:
* Registering a collection with the path `WP_PLUGIN_DIR` will fail.
* Registering a collection with a parent directory of `WP_PLUGIN_DIR`
(e.g. `dirname( WP_PLUGIN_DIR )` or `dirname( WP_PLUGIN_DIR, 2 )`) will
fail.
* Registering a collection within `WP_PLUGIN_DIR` (e.g. `WP_PLUGIN_DIR .
'/my-plugin/blocks'`) will work.
* Registering a collection anywhere else (e.g. `/srv/symlinked/plugins`)
will work.
The same applies for the other default root directories (wp-includes,
must-use plugins, themes).
The PR https://github.com/WordPress/wordpress-develop/pull/8130 has been
updated with this approach and now also has tests covering the behavior,
including the (now optional) filter which can be used to be strict about
custom directories as well.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62140#comment:26>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list