[wp-trac] [WordPress Trac] #55435: use_block_editor_for_post_type filter is broken in 5.9.2

WordPress Trac noreply at wordpress.org
Mon Mar 21 20:17:29 UTC 2022


#55435: use_block_editor_for_post_type filter is broken in 5.9.2
--------------------------+-----------------------------
 Reporter:  haykuro       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 https://github.com/WordPress/WordPress/commit/93d4851bbf9175bd62859ae3d42d266dd947b1f8

 This commit seems to have broken the `use_block_editor_for_post_type`
 filter in WP >= 5.9.

 https://github.com/WordPress/WordPress/blob/5.9.2/wp-includes/default-
 filters.php#L592

 Is part of default-filters:
 {{{#!php
 <?php
 add_action( 'use_block_editor_for_post_type',
 '_disable_block_editor_for_navigation_post_type', 10, 2 );

 }}}

 But that function `_disable_block_editor_for_navigation_post_type` is only
 registered if user is on admin screen.


 So, if you're on homepage and try to: `apply_filters(
 'use_block_editor_for_post_type', true, 'post' )` it will return null and
 throw a warning:

 {{{#!php
 call_user_func_array() expects parameter 1 to be a valid callback,
 function '_disable_block_editor_for_navigation_post_type' not found or
 invalid function name
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55435>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list