From 813c4d604c545b86e32d54169bc2a55d64fb18af Mon Sep 17 00:00:00 2001 From: audrasjb Date: Tue, 26 Apr 2022 06:32:08 +0000 Subject: [PATCH] Bootstrap/load: Move administration related hooks to `admin-filters.php`. This change moves some administration related hooks from `default-filters.php` to `admin-filters.php`. It also updates the `default-filters.php` docblock to indicate that contextualized hooks should be located in the most appropriate place. Props dlh, hellofromTonya, antonvlasenko, audrasjb, azaozz. Fixes #54795. Built from https://develop.svn.wordpress.org/trunk@53266 git-svn-id: http://core.svn.wordpress.org/trunk@52855 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/admin-filters.php | 11 ++++++++++- wp-includes/default-filters.php | 15 +++++++-------- wp-includes/version.php | 2 +- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/wp-admin/includes/admin-filters.php b/wp-admin/includes/admin-filters.php index 078eca0093..953877010a 100644 --- a/wp-admin/includes/admin-filters.php +++ b/wp-admin/includes/admin-filters.php @@ -12,6 +12,7 @@ add_action( 'admin_page_access_denied', 'wp_link_manager_disabled_message' ); // Dashboard hooks. add_action( 'activity_box_end', 'wp_dashboard_quota' ); +add_action( 'welcome_panel', 'wp_welcome_panel' ); // Media hooks. add_action( 'attachment_submitbox_misc_actions', 'attachment_submitbox_metadata' ); @@ -36,14 +37,18 @@ add_filter( 'media_upload_library', 'media_upload_library' ); add_filter( 'media_upload_tabs', 'update_gallery_tab' ); +// Admin color schemes. +add_action( 'admin_head', 'wp_color_scheme_settings' ); +add_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' ); + // Misc hooks. add_action( 'admin_init', 'wp_admin_headers' ); add_action( 'login_init', 'wp_admin_headers' ); add_action( 'admin_head', 'wp_admin_canonical_url' ); -add_action( 'admin_head', 'wp_color_scheme_settings' ); add_action( 'admin_head', 'wp_site_icon' ); add_action( 'admin_head', 'wp_admin_viewport_meta' ); add_action( 'customize_controls_head', 'wp_admin_viewport_meta' ); +add_filter( 'nav_menu_meta_box_object', '_wp_nav_menu_meta_box_object' ); // Prerendering. if ( ! is_customize_preview() ) { @@ -70,6 +75,10 @@ add_filter( 'wp_refresh_nonces', 'wp_refresh_heartbeat_nonces' ); add_filter( 'heartbeat_settings', 'wp_heartbeat_set_suspension' ); +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' ); + // Nav Menu hooks. add_action( 'admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items' ); diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index f373aecbba..0648603ab2 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -7,7 +7,13 @@ * give you the priority for which to use to remove the * hook. * - * Not all of the default hooks are found in default-filters.php + * Not all of the default hooks are found in this file. + * For instance, administration related hooks are located in + * wp-admin/includes/admin-filters.php. + * + * If a hook should only be called from a specific context + * (admin area, multisite environment…), please move it + * to a more appropriate file instead. * * @package WordPress */ @@ -293,7 +299,6 @@ add_filter( 'comments_open', '_close_comments_for_old_post', 10, 2 ); add_filter( 'pings_open', '_close_comments_for_old_post', 10, 2 ); add_filter( 'editable_slug', 'urldecode' ); add_filter( 'editable_slug', 'esc_textarea' ); -add_filter( 'nav_menu_meta_box_object', '_wp_nav_menu_meta_box_object' ); add_filter( 'pingback_ping_source_uri', 'pingback_ping_source_uri' ); add_filter( 'xmlrpc_pingback_error', 'xmlrpc_pingback_error' ); add_filter( 'title_save_pre', 'trim' ); @@ -413,7 +418,6 @@ add_action( 'transition_post_status', '_transition_post_status', 5, 3 ); add_action( 'transition_post_status', '_update_term_count_on_transition_post_status', 10, 3 ); add_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce' ); add_action( 'admin_init', 'send_frame_options_header', 10, 0 ); -add_action( 'welcome_panel', 'wp_welcome_panel' ); // Privacy. add_action( 'user_request_action_confirmed', '_wp_privacy_account_request_confirmed' ); @@ -462,7 +466,6 @@ add_filter( 'pre_option_gmt_offset', 'wp_timezone_override_offset' ); // Admin color schemes. add_action( 'admin_init', 'register_admin_color_schemes', 1 ); -add_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' ); // If the upgrade hasn't run yet, assume link manager is used. add_filter( 'default_option_link_manager_enabled', '__return_true' ); @@ -591,10 +594,6 @@ add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 ); add_action( 'wp_head', 'wp_maybe_inline_styles', 1 ); // Run for styles enqueued in . add_action( 'wp_footer', 'wp_maybe_inline_styles', 1 ); // Run for late-loaded styles in the footer. -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' ); - /* * Disable "Post Attributes" for wp_navigation post type. The attributes are * also conditionally enabled when a site has custom templates. Block Theme diff --git a/wp-includes/version.php b/wp-includes/version.php index 84646dc6da..35029522f6 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-beta2-53265'; +$wp_version = '6.0-beta2-53266'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.