• Resolved groentebroer

    (@groentebroer)


    Hi,

    Great plugin for performance improvement. I have one issue with a hardcoded setting though.

    Why is this part always inserted in the HTML through the plugin?
    My website does not use the Google fonts, so why is this in?

    I removed all preconnect entries in the admin pages, but this still persists in the output.
    Please add those as default (if needed), but offer the ability to remove them as well, because now I have to modify the plugin source to remove it….

    <link rel=’preconnect’ href=’https://fonts.gstatic.com&#8217; />
    <link rel=’preconnect’ href=’https://fonts.googleapis.com&#8217; />

    Which is now hardcoded in:

    public function prefetch_fonts( $hints, $relation_type ) {
                    if ( 'preconnect' !== $relation_type ) {
                            return $hints;
                    }
    
                    // TODO: we need a way to add crossorigin attribute.
    
                    if ( ! in_array( 'https://fonts.gstatic.com', $hints, true ) ) {
                            $hints[] = 'https://fonts.gstatic.com';
                    }
    
                    if ( ! in_array( 'https://fonts.googleapis.com', $hints, true ) ) {
                            $hints[] = 'https://fonts.googleapis.com';
                    }
    
                    return $hints;
            }
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @groentebroer

    I hope you are doing good today.

    I pinged our Hummingbird Team to review this. Thank you for your patience while we look into this further.

    Kind Regards,
    Kris

    Thread Starter groentebroer

    (@groentebroer)

    Thanks Kris for your reply.
    Hope you are doing well as well.

    Sure, no rush I altered the plugin for now.

    Kind regards,
    Groentebroer

    Plugin Support Dimitris – WPMU DEV Support

    (@wpmudev-support6)

    Hello @groentebroer

    We got some feedback from our developers and it seems that there’s no hardcoding, as this works only if a Google font is selected for optimization in Asset Optimization.

    // Google fonts optimization.
    $this->fonts = Settings::get_setting( 'fonts', 'minify' );
    if ( $this->fonts ) {
    	add_filter( 'wp_resource_hints', array( $this, 'prefetch_fonts' ), 10, 2 );
    	add_filter( 'style_loader_tag', array( $this, 'preload_fonts' ), 10, 3 );
    }

    Could you please double-check Asset Optimization in Manual mode? Feel free to “re-check files” in case there’re any recent unlisted assets.

    Warm regards,
    Dimitris

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @groentebroer,

    Since we haven’t heard from you for a while. I’ll mark this thread as resolved for now. Please feel free to re-open the thread if you need further assistance.

    Best Regards
    Nithin

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove the fonts preconnect from always being loaded’ is closed to new replies.