[wp-trac] [WordPress Trac] #46129: Inconsistent logic in allowed_block_types
WordPress Trac
noreply at wordpress.org
Mon Jan 28 18:05:51 UTC 2019
#46129: Inconsistent logic in allowed_block_types
-------------------------+-----------------------------
Reporter: drozdz | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
There are many filters like that in WP (for example `mime_types`,
`manage_posts_columns`, and so on) and all of them are getting a full list
of items as `$allowed` param. This way developers can easy manipulate the
list (add, remove and so on).
On the other hand `allowed_block_types` takes a totally different
approach. If all blocks are allowed, you get "true" as list of allowed
blocks.
OK, it may look convenient, but...
1. It's inconsistent with any other WP filter...
2. It makes it really hard to blacklist blocks (let's say we want to
remove only 2 blocks).
3. It makes getting the list of registered blocks impossible.
PS. I know - you can do this in JS. But I don't think that it's very
convenient to put some options in PHP, store these options in DB and then
in every request pass this value to JS and process it on client-side...
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46129>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list