[wp-trac] [WordPress Trac] #45275: Add a "use_block_editor_for_{post_type}" filter

WordPress Trac noreply at wordpress.org
Tue Nov 6 00:31:21 UTC 2018


#45275: Add a "use_block_editor_for_{post_type}" filter
-------------------------+---------------------
 Reporter:  pento        |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  5.0
Component:  Editor       |     Version:  5.0
 Severity:  normal       |  Resolution:
 Keywords:  needs-patch  |     Focuses:
-------------------------+---------------------

Comment (by euthelup):

 Interesting topic and a good improvement IMO since a composed
 action/filter may get called if it's needed or not, but an action/filter
 served with a parameter will always get a hit.

 I think the case of `use_block_editor_for_post` is a little bit weird
 since it doesn't really check if a `post` uses the block editor, it checks
 if a request through the post.php or post-new.php file does it or not.

 Plus, from what I can understand from the code,
 `use_block_editor_for_post` uses and overwrites the effect of
 `use_block_editor_for_post_type` so maybe this is just a poor naming for
 the `use_block_editor_for_post` hook?

 I'm thinking of a solution, but I'm not sure if it's too much of a hassle
 before a big release:

 1) Deprecate `use_block_editor_for_post` and
 `use_block_editor_for_post_type` filters and make them use new(next)
 functions and filters. But we need to keep them because I think that some
 plugins are using them.

 2) Create a `use_block_editor` function+filter which will take the
 ultimate decision to use the block editor or not for all the post types
 (similar to what `use_block_editor_for_post` does now).

 3) Create a `use_block_editor_for_{post_type}` filter and make
 `use_block_editor_for_post_type` fallback on it.


 I'm not sure about the deprecations tho, but maybe it's better to have a
 clear hooks hierarchy before releasing them in the wild.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45275#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list