• Resolved silasveta

    (@silasveta)


    Google PageSpeed ​​Insights tells me that the WooCommerce star.woff font slows down my site’s loading and suggests that I use the <link rel = preload> tag to save approximately 2.35 seconds. Can someone show me how I can fix this? I read a bunch of articles, tried a bunch of codes, it didn’t help.

    function my_queue_items() {
    wp_enqueue_style( ‘rating-stars’, ‘/wp-content/plugins/woocommerce/assets/fonts/star.woff’ );
    wp_script_add_data( ‘rating-star’, ‘crossorigin’, ‘anonymous’ ); // Adds Crossorigin Attribute
    }
    add_action( ‘wp_enqueue_scripts’, ‘my_queue_items’, 99 );

    // Enqueue Your Font
    function my_queue_items() {
    wp_enqueue_style( ‘rating-stars’, ‘/wp-content/plugins/woocommerce/assets/fonts/star.woff’, array(), null );
    }
    add_action( ‘wp_enqueue_scripts’, ‘my_queue_items’, 99 );

    // Add Crossorigin Attribute To Your Font
    function style_attributes( $html, $handle ) {
    if ( ‘rating-stars’ === $handle ) {
    return str_replace( “media=’all'”, “media=’all’ crossorigin=’anonymous'”, $html );
    }
    return $html;
    }
    add_filter( ‘style_loader_tag’, ‘style_attributes’, 10, 2 );

    <link rel=”preload” href=”Font URL Showing in PageSpeed” as=”font” crossorigin=”anonymous”>

    No result!!!!!

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘WooCommerce star.woff font slows down my site’s loading and suggests that I use’ is closed to new replies.