id summary reporter owner description type status priority milestone component version severity resolution keywords cc focuses 54795 Bootstrap: Move navigation post type hooks to `admin-filters.php` dlh audrasjb "WordPress 5.9 adds some new actions and filters to `default-filters.php` into hooks that typically run only in the admin, such as `admin_head` and `admin_footer-widgets.php`. I can see that there are plenty of other similar examples that predate 5.9, and, generally, it's not a big deal. However, three of these new hooks go one step further by adding callbacks that are themselves only loaded in the admin: {{{ add_action( 'use_block_editor_for_post_type', '_disable_block_editor_for_navigation_post_type', 10, 2 ); add_action( 'edit_form_after_title', '_disable_content_editor_for_navigation_post_type' ); add_action( 'edit_form_after_editor', '_enable_content_editor_for_navigation_post_type' ); }}} There is precedent, too, for adding admin-only callbacks in `default-filters.php`, but the implications are more noticeable: On PHP 8+, a fatal error will occur if those hooks fire in a non-admin context and attempt to call an undefined function. I hear you asking: Isn't somebody doing it wrong if those hooks run outside the admin? Probably. Did I, myself, manually apply the `use_block_editor_for_post_type` filter in a plugin? I sure did, and I'll fix the plugin :) Still, I was on the fence about whether adding admin-only functions to `default-filters.php` is also not quite doing it right. It risks creating new warnings or fatal errors without serving an obvious (to me) purpose for core. [32653] described `admin-filters.php` as ""[containing] functions that won't work outside of admin context."" So, I thought I would open a ticket to ask: 1. Should the new default actions and filters in 5.9 that call admin-only functions be moved to `admin-filters.php`? (They seemed to work as expected there when I tested.) 2. Should the three admin-only functions instead be globally included, not admin-only? " defect (bug) closed normal 6.0 Bootstrap/Load normal fixed has-patch commit assigned-for-commit