Make WordPress Core

Ticket #55917: 55917.2.diff

File 55917.2.diff, 876 bytes (added by SergeyBiryukov, 21 months ago)
  • src/wp-includes/script-loader.php

     
    35233523                wp_add_inline_style( 'wp-block-library', $styles );
    35243524        };
    35253525
    3526         add_action( 'wp_loaded', $fn_register_webfonts );
     3526        /*
     3527         * Webfonts need to be properly loaded and available:
     3528         * - In the block editor, both in the normal Edit screen and the Site Editor.
     3529         * - In REST API calls for the editor, because some styles get added via REST calls.
     3530         * - On the front end.
     3531         * The 'wp' action is one of the very few that work for all cases.
     3532         */
     3533        add_action( 'wp', $fn_register_webfonts );
    35273534        add_action( 'wp_enqueue_scripts', $fn_generate_and_enqueue_styles );
    35283535        add_action( 'admin_init', $fn_generate_and_enqueue_editor_styles );
    35293536}