• 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)
  • Hi there @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?

    This is a fairly complex code-related topic and custom coding is outside of scope of our support. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Lastly, I found this thread on the related topic https://stackoverflow.com/questions/55223026/preload-woocommerce-star-woff-font

    I hope that’s helpful and points you in the right direction.

    Cheers!

    Thread Starter silasveta

    (@silasveta)

    Hi, this is not working. I have already read these unsubscribes from your help. Really, no one wanted to think about this problem, because almost everyone on the site has it. It would help really speed up sites. All the best

    Hi,

    As my colleague mentioned, this kind of customization is not really something we can assist with here. I did find an article about using the WP Rocket plugin to preload fonts:

    https://www.webnots.com/how-to-fix-preload-key-requests-with-fonts-in-wordpress/

    The plugin you will need to do this is:

    https://wp-rocket.me/

    That plugin is not free, it is also not part of www.ads-software.com or WooCommerce.com so support for that will be managed by their team directly. You may also find other ways to do this. There look to be a few articles out there on preloading fonts for WordPress.

    Since this issue is outside of our support scope I am going to mark this issue as resolved. If you have any other issues to address, feel free to open a new request.

    Take care!

    Thread Starter silasveta

    (@silasveta)

    <link rel=”preload” href=”https://site.ru/wp-content/plugins/woocommerce/assets/fonts/star.woff&#8221; as=”font” crossorigin=”anonymous”>
    Here’s a solution that works one hundred percent. Paste in heder, as in your link to the article. Thank you

    Hello, I’ve tried this, but it doesn’t work.Is there a solution?

    Thread Starter silasveta

    (@silasveta)

    Решение я нашел еще проще, это плагин Autoptimize. Во вкладке дополнительно, есть строка (прилагаю скриншот), и полная версия. Вставляете ссылку из гугл
    PageSpeed Insights.
    любого шрифта для предварительной загрузки, через запятую. М все работает!!!!) Удачи.

    • This reply was modified 3 years, 9 months ago by silasveta.
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.