• Resolved mumbomedia

    (@mumbomedia)


    Dear Mr. van den Bergh,

    First of all, thank you for this fantastic plugin—it helps us a lot to stay compliant with GDPR.

    However, I encountered a small issue when using the plugin alongside Elementor. As you may know, Elementor offers the option to load Google Fonts locally. Currently, OMGF does not detect that these fonts are already included locally. As a result, the condition in src/Download.php around line 70 evaluates as true, and the plugin unnecessarily downloads the font. This leads to unnecessary duplicates on the webspace and subsequently triggers the condition on line 76.

    I would recommend adding a check after the condition on line 70, for example:

    if ( str_starts_with( $this_url, WP_SITEURL ) ) {
    return ”;
    }

    This would prevent fonts that are already included locally from being downloaded unnecessarily. You may also want to add a similar check for the http:// variant.

    Thank you for considering this, and for your continued work on OMGF.

    With collegial regards,
    Alexander Behling
    Tech Lead at Mumbo Jumbo Media

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Daan van den Bergh

    (@daanvandenbergh)

    Hi Alexander!

    Thanks for your feedback! You make a good point.

    The current behaviour is intentional, because Elementor includes all font variants when a certain font family is selected, and OMGF users requested the ability to be able to unload the unused font styles.

    However, you make a good point about OMGF re-downloading the font files. It should use the font files already available on the webspace. Your fix won’t cut it, unfortunately, because further down the line it’ll stop generating the stylesheet.

    I’ll add this to my TODO list for investigation and hopefully I can provide a fix.

    Thanks again!

    Thread Starter mumbomedia

    (@mumbomedia)

    Your welcome.

    In the meantime I ‘m working on workaround so the URL Elementor give to wp_enqueue_style becomes relative. Therefore your plugin should detect it correctly as already locally.

    Maybe this is also an important detail: All local google fonts of Elementor use a handle which starts with elementor-gf-local- following by the sanitized font name e.g. barlow.

    Thread Starter mumbomedia

    (@mumbomedia)

    I have finally found a temporaly solution which I want to share for the community so other users facing the same issue can benefit from it.

    Temporary Cleanup & Reset for Elementor Local Google Fonts

    If you encounter duplicate fonts being downloaded by OMGF when using Elementor, follow these steps to reset and clean up the local fonts:

    1. Delete the option from the database:
      DELETE FROM wp_options WHERE option_name = '_elementor_local_google_fonts';
      Note: if you use a custom database prefix, replace wp_ with your prefix. (Or use PHPMyAdmin / WP-CLI.)
    2. Disable local Google Fonts in Elementor:
      Go to /wp-admin/admin.php?page=elementor-settings#tab-performance and turn off “Load Google Fonts Locally”.
    3. Remove old font files:
      Delete /wp-content/uploads/elementor/google-fonts and any directories in /wp-content/uploads/omgf/ that start with elementor.
    4. Clear Elementor cache:
      Go to /wp-admin/admin.php?page=elementor-tools → Click “Clear Files & Data”.

    After this, on the next page load, OMGF will detect that Elementor is loading Google Fonts from Google and will download them only once to your webspace, avoiding unnecessary duplicates.

    Plugin Author Daan van den Bergh

    (@daanvandenbergh)

    Thanks for the temporary workaround!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Unnecessary font download when Elementor uses Google Fonts locally’ is closed to new replies.