diff -r be944660c56a -r 3d72ae0968f4 wp/wp-includes/default-filters.php --- a/wp/wp-includes/default-filters.php Wed Sep 21 18:19:35 2022 +0200 +++ b/wp/wp-includes/default-filters.php Tue Sep 27 16:37:53 2022 +0200 @@ -4,10 +4,15 @@ * of the WordPress hooks. * * If you need to remove a default hook, this file will - * give you the priority for which to use to remove the - * hook. + * give you the priority to use for removing 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 */ @@ -98,6 +103,13 @@ // Meta. add_filter( 'register_meta_args', '_wp_register_meta_args_allowed_list', 10, 2 ); +// Counts. +add_action( 'admin_init', 'wp_schedule_update_user_counts' ); +add_action( 'wp_update_user_counts', 'wp_schedule_update_user_counts', 10, 0 ); +foreach ( array( 'user_register', 'deleted_user' ) as $action ) { + add_action( $action, 'wp_maybe_update_user_counts', 10, 0 ); +} + // Post meta. add_action( 'added_post_meta', 'wp_cache_set_posts_last_changed' ); add_action( 'updated_post_meta', 'wp_cache_set_posts_last_changed' ); @@ -286,7 +298,6 @@ 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' ); @@ -332,13 +343,14 @@ add_action( 'template_redirect', 'wp_shortlink_header', 11, 0 ); add_action( 'wp_print_footer_scripts', '_wp_footer_scripts' ); add_action( 'init', '_register_core_block_patterns_and_categories' ); -add_action( 'current_screen', '_load_remote_block_patterns' ); add_action( 'init', 'check_theme_switched', 99 ); add_action( 'init', array( 'WP_Block_Supports', 'init' ), 22 ); add_action( 'switch_theme', array( 'WP_Theme_JSON_Resolver', 'clean_cached_data' ) ); +add_action( 'start_previewing_theme', array( 'WP_Theme_JSON_Resolver', 'clean_cached_data' ) ); add_action( 'after_switch_theme', '_wp_menus_changed' ); add_action( 'after_switch_theme', '_wp_sidebars_changed' ); add_action( 'wp_print_styles', 'print_emoji_styles' ); +add_action( 'plugins_loaded', '_wp_theme_json_webfonts_handler' ); if ( isset( $_GET['replytocom'] ) ) { add_filter( 'wp_robots', 'wp_robots_no_robots' ); @@ -390,11 +402,6 @@ add_action( 'do_favicon', 'do_favicon' ); add_action( 'set_comment_cookies', 'wp_set_comment_cookies', 10, 3 ); add_action( 'sanitize_comment_cookies', 'sanitize_comment_cookies' ); -add_action( 'admin_print_scripts', 'print_emoji_detection_script' ); -add_action( 'admin_print_scripts', 'print_head_scripts', 20 ); -add_action( 'admin_print_footer_scripts', '_wp_footer_scripts' ); -add_action( 'admin_print_styles', 'print_emoji_styles' ); -add_action( 'admin_print_styles', 'print_admin_styles', 20 ); add_action( 'init', 'smilies_init', 5 ); add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 ); add_action( 'plugins_loaded', 'wp_maybe_load_embeds', 0 ); @@ -405,8 +412,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' ); @@ -453,10 +458,6 @@ // Timezone. 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' ); @@ -513,6 +514,7 @@ */ // Theme. add_action( 'setup_theme', 'create_initial_theme_features', 0 ); +add_action( 'setup_theme', '_add_default_theme_supports', 1 ); add_action( 'wp_loaded', '_custom_header_background_just_in_time' ); add_action( 'wp_head', '_custom_logo_header_styles' ); add_action( 'plugins_loaded', '_wp_customize_include' ); @@ -562,7 +564,7 @@ add_action( 'enqueue_block_editor_assets', 'enqueue_editor_block_styles_assets' ); add_action( 'enqueue_block_editor_assets', 'wp_enqueue_editor_block_directory_assets' ); add_action( 'enqueue_block_editor_assets', 'wp_enqueue_editor_format_library_assets' ); -add_action( 'admin_print_scripts-index.php', 'wp_localize_community_events' ); +add_action( 'enqueue_block_editor_assets', 'wp_enqueue_global_styles_css_custom_properties' ); add_filter( 'wp_print_scripts', 'wp_just_in_time_script_localization' ); add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' ); add_filter( 'customize_controls_print_styles', 'wp_resource_hints', 1 ); @@ -572,14 +574,22 @@ add_action( 'wp_enqueue_scripts', 'wp_enqueue_global_styles' ); add_action( 'wp_footer', 'wp_enqueue_global_styles', 1 ); +// SVG filters like duotone have to be loaded at the beginning of the body in both admin and the front-end. +add_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' ); +add_action( 'in_admin_header', 'wp_global_styles_render_svg_filters' ); + add_action( 'wp_default_styles', 'wp_default_styles' ); 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( 'admin_footer-post.php', 'wp_add_iframed_editor_assets_html' ); -add_action( 'admin_footer-post-new.php', 'wp_add_iframed_editor_assets_html' ); +/* + * Disable "Post Attributes" for wp_navigation post type. The attributes are + * also conditionally enabled when a site has custom templates. Block Theme + * templates can be available for every post type. + */ +add_filter( 'theme_wp_navigation_templates', '__return_empty_array' ); // Taxonomy. add_action( 'init', 'create_initial_taxonomies', 0 ); // Highest priority. @@ -604,6 +614,7 @@ // Widgets. add_action( 'after_setup_theme', 'wp_setup_widgets_block_editor', 1 ); add_action( 'init', 'wp_widgets_init', 1 ); +add_action( 'change_locale', array( 'WP_Widget_Media', 'reset_default_labels' ) ); // Admin Bar. // Don't remove. Wrong way to disable. @@ -625,7 +636,8 @@ add_filter( 'rest_pre_serve_request', '_oembed_rest_pre_serve_request', 10, 4 ); add_action( 'wp_head', 'wp_oembed_add_discovery_links' ); -add_action( 'wp_head', 'wp_oembed_add_host_js' ); +add_action( 'wp_head', 'wp_oembed_add_host_js' ); // Back-compat for sites disabling oEmbed host JS by removing action. +add_filter( 'embed_oembed_html', 'wp_maybe_enqueue_oembed_host_js' ); add_action( 'embed_head', 'enqueue_embed_scripts', 1 ); add_action( 'embed_head', 'print_emoji_detection_script' ); @@ -660,10 +672,12 @@ add_filter( 'user_has_cap', 'wp_maybe_grant_resume_extensions_caps', 1 ); add_filter( 'user_has_cap', 'wp_maybe_grant_site_health_caps', 1, 4 ); -// Block Templates CPT and Rendering +// Block templates post type and rendering. add_filter( 'render_block_context', '_block_template_render_without_post_block_context' ); add_filter( 'pre_wp_unique_post_slug', 'wp_filter_wp_template_unique_post_slug', 10, 5 ); +add_action( 'save_post_wp_template_part', 'wp_set_unique_slug_on_create_template_part' ); add_action( 'wp_footer', 'the_block_template_skip_link' ); add_action( 'setup_theme', 'wp_enable_block_templates' ); +add_action( 'wp_loaded', '_add_template_loader_filters' ); unset( $filter, $action );