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

WordPress Trac noreply at wordpress.org
Fri Dec 7 03:11:59 UTC 2018


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

Comment (by elliotcondon):

 @pento Please reconsider adding in this filter. I don't see how there is
 any effort to maintain it.

 This is a single line of code in core that both optimizes all 3rd party
 plugins and could even avoid a "snowball" issue due to bad 3rd party code.

 Please change:

 {{{
 /**
          * Filter whether a post is able to be edited in the block editor.
          *
          * @since 5.0.0
          *
          * @param bool   $use_block_editor  Whether the post type can be
 edited or not. Default true.
          * @param string $post_type         The post type being checked.
          */
         return apply_filters( 'use_block_editor_for_post_type', true,
 $post_type );
 }}}

 to:


 {{{
 /**
          * Filter whether a post is able to be edited in the block editor.
          *
          * @since 5.0.0
          *
          * @param bool   $use_block_editor  Whether the post type can be
 edited or not. Default true.
          * @param string $post_type         The post type being checked.
          */
         $use_block_editor = apply_filters(
 "use_block_editor_for_post_type", true, $post_type );
         return apply_filters( "use_block_editor_for_{$post_type}",
 $use_block_editor );
 }}}

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


More information about the wp-trac mailing list