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
This commit is contained in:
audrasjb 2022-04-26 06:32:08 +00:00
parent 29cc1e94c0
commit 813c4d604c
3 changed files with 18 additions and 10 deletions

View File

@ -12,6 +12,7 @@ add_action( 'admin_page_access_denied', 'wp_link_manager_disabled_message' );
// Dashboard hooks. // Dashboard hooks.
add_action( 'activity_box_end', 'wp_dashboard_quota' ); add_action( 'activity_box_end', 'wp_dashboard_quota' );
add_action( 'welcome_panel', 'wp_welcome_panel' );
// Media hooks. // Media hooks.
add_action( 'attachment_submitbox_misc_actions', 'attachment_submitbox_metadata' ); 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' ); 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. // Misc hooks.
add_action( 'admin_init', 'wp_admin_headers' ); add_action( 'admin_init', 'wp_admin_headers' );
add_action( 'login_init', 'wp_admin_headers' ); add_action( 'login_init', 'wp_admin_headers' );
add_action( 'admin_head', 'wp_admin_canonical_url' ); 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_site_icon' );
add_action( 'admin_head', 'wp_admin_viewport_meta' ); add_action( 'admin_head', 'wp_admin_viewport_meta' );
add_action( 'customize_controls_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. // Prerendering.
if ( ! is_customize_preview() ) { 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_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. // Nav Menu hooks.
add_action( 'admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items' ); add_action( 'admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items' );

View File

@ -7,7 +7,13 @@
* give you the priority for which to use to remove the * give you the priority for which to use to remove the
* hook. * 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 * @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( 'pings_open', '_close_comments_for_old_post', 10, 2 );
add_filter( 'editable_slug', 'urldecode' ); add_filter( 'editable_slug', 'urldecode' );
add_filter( 'editable_slug', 'esc_textarea' ); 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( 'pingback_ping_source_uri', 'pingback_ping_source_uri' );
add_filter( 'xmlrpc_pingback_error', 'xmlrpc_pingback_error' ); add_filter( 'xmlrpc_pingback_error', 'xmlrpc_pingback_error' );
add_filter( 'title_save_pre', 'trim' ); 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( 'transition_post_status', '_update_term_count_on_transition_post_status', 10, 3 );
add_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce' ); add_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce' );
add_action( 'admin_init', 'send_frame_options_header', 10, 0 ); add_action( 'admin_init', 'send_frame_options_header', 10, 0 );
add_action( 'welcome_panel', 'wp_welcome_panel' );
// Privacy. // Privacy.
add_action( 'user_request_action_confirmed', '_wp_privacy_account_request_confirmed' ); 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. // Admin color schemes.
add_action( 'admin_init', 'register_admin_color_schemes', 1 ); 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. // If the upgrade hasn't run yet, assume link manager is used.
add_filter( 'default_option_link_manager_enabled', '__return_true' ); 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 <head>. add_action( 'wp_head', 'wp_maybe_inline_styles', 1 ); // Run for styles enqueued in <head>.
add_action( 'wp_footer', 'wp_maybe_inline_styles', 1 ); // Run for late-loaded styles in the footer. 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 * Disable "Post Attributes" for wp_navigation post type. The attributes are
* also conditionally enabled when a site has custom templates. Block Theme * also conditionally enabled when a site has custom templates. Block Theme

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @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. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.