• pk385

    (@pk385)


    Updated to 4.0.0 today, page load times went from 1-2 seconds to 9-10 seconds.

    There’s something seriously broken in the google fonts integration with the new update.

    Just look at the comparison from 4.0.0 to 3.6.1:

    This happens when google fonts are enabled, regardless of any other options.

    I didn’t get a screenshot of it and won’t switch back to 4.0.0 but all the HTTP calls are for google fonts trying to load on the server side.

Viewing 15 replies - 1 through 15 (of 18 total)
  • Shahin

    (@skalanter)

    Hello @pk385,

    Thank you for reaching out,
    And sorry to hear about the issues you’re experiencing, though you have not shared many details.

    There have not been any changes to the Google Fonts integration, other than Google Fonts are disabled by default on new instances, but every user can enable them. Kindly ensure your Google Fonts are enabled. For speed optimization, you can also choose to host them locally, as well as choose which font format you wish to use.

    Either way, if not hosted locally, Google Fonts depends on Google, since these are external scripts.

    If hosted locally, the speed depends on the website server itself.
    Kindly make sure to update everything, OceanWP theme and all free and premium plugins, as well as clear the cache on all levels. https://docs.oceanwp.org/article/896-customizer-typography#Google-Font-Settings-EPxsL

    But we would love to hear more about your testing after in which you’ll include all steps, so that we can try and replicate this on our end.

    As far as the OceanWP 4 upgrade goes, all feedback has been great so far, except for a minor issue with plugin notifications on multisite environments, but which are totally unrelated to the update itself.

    Meanwhile, could you tell us how we can replicate your steps to arrive at the issue on a fresh WordPress installation? We need to know how we can recreate it somewhere other than your website, then we can provide a solution to solve it.

    And would be great if you could provide us with some screenshots from the customizer settings and share a live URL of your website. So we’ll deeply check your URL on online tools and test the conditions you’ve on your website.

    Also, kindly provide us with your system environment information. To do this, please go to WP Dashboard > Tools > Site Health > Info Tab and click on the button Copy site info to clipboard. You can send the information as code here or upload them to https://pastebin.com/ or https://gist.github.com/ and get an exclusive link: https://i.postimg.cc/fbjtkFyJ/image.png(you can remove your email address from the content).

    Please keep us posted on the results.

    Thank you,
    And hope it helps.
    Best Regards

    chordzillastatistics

    (@chordzillastatistics)

    Hi. I’ve been using the theme for a couple of months. I had automatic theme updates enabled and wasn’t aware an update was coming. Now, after the update, my site is incredibly slow. PageSpeed and Lighthouse tests show great results, but switching between pages takes several seconds. There are no analytics or ad systems on my site that could slow it down. This issue started right after the update.

    If I compare my site with your theme (without ads or analytics) to another site that handles 100,000 unique visitors daily, is heavily promoted, and has analytics but no caching plugin, your theme site is five times slower. My site has caching that was working perfectly before the update. Now, everything is very slow. How can I fix this? I might have to revert to the previous version of the theme because it’s impossible to work like this.

    UPD. I reverted to version 3.6.1 of the theme, and everything is working as it should again.

    chordzillastatistics

    (@chordzillastatistics)

    I confirm the theory about using Google Fonts. As soon as they’re enabled, the pages start loading in several seconds. In the old version of the theme, there was no such issue, and pages loaded instantly. The problem occurs specifically when Google Fonts are activated. I’m using a child theme.

    Thread Starter pk385

    (@pk385)

    @skalanter
    Not comfortable sharing the domain here, hope that’s understandable. Another thing I noticed when google fonts were failing to load on the frontend (opting not to serve from local): The weight was specified in the URL to the google fonts API, in my instance the family and weight were ‘Questrial’ and ‘700’ respectively. Google does not serve this font in 700 weight, only 400, causing an API error to be returned instead of the font file.

    I’m speculating that maybe the previous version handled this situation differently as setting 700 weight in the customizer resulted in the intended appearance with no errors, seemingly because the 700 weight is being set in the inline CSS instead of only, or also, being passed into the URL as a parameter when fetching the font from google.

    The only other plugins I have that touch google fonts are elementor pro and autoptimize. I immediately assumed autoptimize to be the culprit but adding the bypass parameter ‘ao_noptimize=1’ to bypass the plugin and load the normal CSS and JS yielded the same result. Also, all the instances of google fonts where elementor was doing the loading worked without issue.

    System Info:

    ### wp-core ###

    version: 6.6.2

    site_language: en_US

    user_language: en_US

    timezone: America/New_York

    permalink: /%postname%/

    https_status: true

    multisite: false

    user_registration: 1

    blog_public: 1

    default_comment_status: open

    environment_type: production

    user_count: 142

    dotorg_communication: true

    ### wp-paths-sizes ###

    wordpress_path: /var/www/[site-name].com/wordpress

    wordpress_size: 102.21 MB (107177739 bytes)

    uploads_path: /var/www/[site-name].com/wordpress/wp-content/uploads

    uploads_size: 768.07 MB (805383723 bytes)

    themes_path: /var/www/[site-name].com/wordpress/wp-content/themes

    themes_size: 24.73 MB (25935138 bytes)

    plugins_path: /var/www/[site-name].com/wordpress/wp-content/plugins

    plugins_size: 281.33 MB (294993459 bytes)

    fonts_path: /var/www/[site-name].com/wordpress/wp-content/uploads/fonts

    fonts_size: directory not found

    database_size: 504.42 MB (528924672 bytes)

    total_size: 1.64 GB (1762414731 bytes)

    ### wp-dropins (3) ###

    advanced-cache.php: true

    db.php: true

    object-cache.php: true

    ### wp-active-theme ###

    name: OceanWP Child Theme (oceanwp-child-theme)

    version: 1.0

    author: OceanWP

    author_website: https://oceanwp.org/

    parent_theme: OceanWP (oceanwp)

    theme_features: core-block-patterns, widgets-block-editor, post-thumbnails, align-wide, wp-block-styles, responsive-embeds, editor-styles, editor-style, menus, post-formats, title-tag, automatic-feed-links, custom-header, custom-logo, html5, woocommerce, wc-product-gallery-zoom, wc-product-gallery-lightbox, wc-product-gallery-slider, customize-selective-refresh-widgets, widgets

    theme_path: /var/www/[site-name].com/wordpress/wp-content/themes/oceanwp-child-theme

    auto_update: Disabled

    ### wp-parent-theme ###

    name: OceanWP (oceanwp)

    version: 3.6.1 (latest version: 4.0.0)

    author: OceanWP

    author_website: https://oceanwp.org/about-oceanwp/

    theme_path: /var/www/[site-name].com/wordpress/wp-content/themes/oceanwp

    auto_update: Disabled

    ### wp-themes-inactive (2) ###

    Twenty Twenty-Four: version: 1.2, author: the WordPress team, Auto-updates disabled

    Twenty Twenty-Three: version: 1.5, author: the WordPress team, Auto-updates disabled

    ### wp-plugins-active (38) ###

    Advanced Custom Fields: version: 6.3.9, author: WP Engine, Auto-updates disabled

    AntiSpam for Contact Form 7: version: 0.6.3, author: Codekraft, Auto-updates disabled

    Async JavaScript: version: 2.21.08.31, author: Frank Goossens (futtta), Auto-updates disabled

    Autoptimize: version: 3.1.12, author: Frank Goossens (futtta), Auto-updates disabled

    Bing Webmaster Url Submission: version: 1.0.13, author: Bing Webmaster, Auto-updates disabled

    Cloudflare: version: 4.12.8, author: Cloudflare, Inc., Auto-updates disabled

    Contact Form 7: version: 5.9.8, author: Takayuki Miyoshi, Auto-updates disabled

    Contact Form CFDB7: version: 1.2.7, author: Arshid, Auto-updates disabled

    CookieYes | GDPR Cookie Consent: version: 3.2.7, author: CookieYes, Auto-updates disabled

    Elementor: version: 3.24.7, author: Elementor.com, Auto-updates disabled

    Elementor Pro: version: 3.24.4, author: Elementor.com, Auto-updates disabled

    Email Template Customizer for WooCommerce: version: 1.2.5, author: VillaTheme, Auto-updates disabled

    Facebook for WooCommerce: version: 3.2.10, author: Facebook, Auto-updates disabled

    FiboSearch - AJAX Search for WooCommerce: version: 1.28.1, author: FiboSearch Team, Auto-updates disabled

    Google Analytics for WooCommerce: version: 2.1.7, author: WooCommerce, Auto-updates disabled

    Google for WooCommerce: version: 2.8.6, author: WooCommerce, Auto-updates disabled

    hCaptcha for WP: version: 4.6.0, author: hCaptcha, Auto-updates disabled

    Hide Admin Notices: version: 2.1, author: PontetLabs, Auto-updates disabled

    Members: version: 3.2.10, author: MemberPress, Auto-updates disabled

    Object Cache 4 everyone: version: 2.2, author: fpuenteonline, Auto-updates disabled

    Ocean Extra: version: 2.4.0, author: OceanWP, Auto-updates disabled

    Ocean Social Sharing: version: 2.2.0, author: OceanWP, Auto-updates disabled

    PDF Invoices & Packing Slips for WooCommerce: version: 3.8.8, author: WP Overnight, Auto-updates disabled

    Query Monitor: version: 3.16.4, author: John Blackbourn, Auto-updates disabled

    Regenerate Thumbnails: version: 3.1.6, author: Alex Mills (Viper007Bond), Auto-updates disabled

    Site Kit by Google: version: 1.137.0, author: Google, Auto-updates disabled

    TI WooCommerce Wishlist: version: 2.9.0, author: TemplateInvaders, Auto-updates disabled

    WooCommerce: version: 9.3.3, author: Automattic, Auto-updates disabled

    WooCommerce.com Update Manager: version: 1.0.3, author: Automattic, Auto-updates disabled

    WooCommerce PayPal Payments: version: 2.9.3, author: WooCommerce, Auto-updates disabled

    WooCommerce Shipping & Tax: version: 2.8.2, author: WooCommerce, Auto-updates disabled

    WooCommerce Stripe Gateway: version: 8.7.0, author: WooCommerce, Auto-updates disabled

    WooCommerce UPS Shipping: version: 3.7.1, author: WooCommerce, Auto-updates disabled

    WordPress Importer: version: 0.8.2, author: wordpressdotorg, Auto-updates disabled

    WP Consent API: version: 1.0.7, author: RogierLankhorst, Auto-updates disabled

    WP Mail Logging: version: 1.13.1, author: WP Mail Logging Team, Auto-updates disabled

    WP Super Cache: version: 1.12.4, author: Automattic, Auto-updates disabled

    Yoast SEO: version: 23.6, author: Team Yoast, Auto-updates disabled

    ### wp-plugins-inactive (1) ###

    BTCPay For Woocommerce V2: version: 2.7.0, author: BTCPay Server, Auto-updates disabled

    ### wp-media ###

    image_editor: WP_Image_Editor_Imagick

    imagick_module_version: 1691

    imagemagick_version: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org

    imagick_version: 3.6.0

    file_uploads: 1

    post_max_size: 1G

    upload_max_filesize: 1G

    max_effective_size: 1 GB

    max_file_uploads: 20

    imagick_limits:

      imagick::RESOURCETYPE_AREA: 122 MB

      imagick::RESOURCETYPE_DISK: 1073741824

      imagick::RESOURCETYPE_FILE: 768

      imagick::RESOURCETYPE_MAP: 512 MB

      imagick::RESOURCETYPE_MEMORY: 256 MB

      imagick::RESOURCETYPE_THREAD: 1

      imagick::RESOURCETYPE_TIME: 9.2233720368548E+18

    imagemagick_file_formats: 3FR, 3G2, 3GP, AAI, AI, APNG, ART, ARW, AVI, AVIF, AVS, BGR, BGRA, BGRO, BIE, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CR3, CRW, CUR, CUT, DATA, DCM, DCR, DCX, DDS, DFONT, DNG, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, FAX, FILE, FITS, FRACTAL, FTP, FTS, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, H, HALD, HDR, HEIC, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, J2C, J2K, JBG, JBIG, JNG, JNX, JP2, JPC, JPE, JPEG, JPG, JPM, JPS, JPT, JSON, K25, KDC, LABEL, M2V, M4V, MAC, MAGICK, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPG, MRW, MSL, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PAM, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, POCKETMOD, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIDEO, VIFF, VIPS, VST, WBMP, WEBM, WEBP, WMV, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, YCbCr, YCbCrA, YUV

    gd_version: 2.3.0

    gd_formats: GIF, JPEG, PNG, WebP, BMP, XPM

    ghostscript_version: 9.55.0

    ### wp-server ###

    server_architecture: Linux 5.15.0-118-generic x86_64

    httpd_software: nginx/1.18.0

    php_version: 8.1.2-1ubuntu2.19 64bit

    php_sapi: fpm-fcgi

    max_input_variables: 1000

    time_limit: 30

    memory_limit: 256M

    admin_memory_limit: 512M

    max_input_time: 60

    upload_max_filesize: 1G

    php_post_max_size: 1G

    curl_version: 7.81.0 OpenSSL/3.0.2

    suhosin: false

    imagick_availability: true

    pretty_permalinks: true

    current: 2024-10-16T17:45:56+00:00

    utc-time: Wednesday, 16-Oct-24 17:45:56 UTC

    server-time: 2024-10-16T13:45:54-04:00

    ### wp-database ###

    extension: mysqli

    server_version: 10.6.18-MariaDB-0ubuntu0.22.04.1

    client_version: mysqlnd 8.1.2-1ubuntu2.19

    max_allowed_packet: 16777216

    max_connections: 151

    ### wp-constants ###

    WP_HOME: undefined

    WP_SITEURL: undefined

    WP_CONTENT_DIR: /var/www/[site-name].com/wordpress/wp-content

    WP_PLUGIN_DIR: /var/www/[site-name].com/wordpress/wp-content/plugins

    WP_MEMORY_LIMIT: 256M

    WP_MAX_MEMORY_LIMIT: 512M

    WP_DEBUG: true

    WP_DEBUG_DISPLAY: false

    WP_DEBUG_LOG: /var/log/wordpress/debug.log

    SCRIPT_DEBUG: false

    WP_CACHE: true

    CONCATENATE_SCRIPTS: undefined

    COMPRESS_SCRIPTS: undefined

    COMPRESS_CSS: undefined

    WP_ENVIRONMENT_TYPE: Undefined

    WP_DEVELOPMENT_MODE: undefined

    DB_CHARSET: utf8

    DB_COLLATE: undefined

    ### wp-filesystem ###

    wordpress: writable

    wp-content: writable

    uploads: writable

    plugins: writable

    themes: writable

    fonts: not writable

    ### acf ###

    version: 6.3.9

    plugin_type: Free

    update_source: ACF Direct

    ui_field_groups: 11

    php_field_groups: 0

    json_field_groups: 0

    rest_field_groups: 0

    post_types_enabled: true

    ui_post_types: 22

    json_post_types: 0

    ui_taxonomies: 15

    json_taxonomies: 0

    rest_api_format: light

    admin_ui_enabled: true

    field_type-modal_enabled: true

    field_settings_tabs_enabled: false

    shortcode_enabled: true

    registered_acf_forms: 0

    json_save_paths: 1

    json_load_paths: 1

    ### google-site-kit ###

    version: 1.137.0

    php_version: 8.1.2-1ubuntu2.19

    wp_version: 6.6.2

    reference_url: https://www.[site-name].com

    amp_mode: no

    site_status: connected-site

    user_status: authenticated

    verification_status: verified-file

    connected_user_count: 1

    active_modules: site-verification, search-console, ads, analytics-4, pagespeed-insights, tagmanager

    recoverable_modules: none

    required_scopes:

      openid: ?

      https://www.googleapis.com/auth/userinfo.profile: ?

      https://www.googleapis.com/auth/userinfo.email: ?

      https://www.googleapis.com/auth/siteverification: ?

      https://www.googleapis.com/auth/webmasters: ?

      https://www.googleapis.com/auth/analytics.readonly: ?

      https://www.googleapis.com/auth/tagmanager.readonly: ?

    capabilities:

      googlesitekit_authenticate: ?

      googlesitekit_setup: ?

      googlesitekit_view_posts_insights: ?

      googlesitekit_view_dashboard: ?

      googlesitekit_manage_options: ?

      googlesitekit_update_plugins: ?

      googlesitekit_view_splash: ?

      googlesitekit_view_authenticated_dashboard: ?

      googlesitekit_view_wp_dashboard_widget: ?

      googlesitekit_view_admin_bar_menu: ?

      googlesitekit_view_shared_dashboard: ?

      googlesitekit_read_shared_module_data::["search-console"]: ?

      googlesitekit_read_shared_module_data::["analytics-4"]: ?

      googlesitekit_read_shared_module_data::["pagespeed-insights"]: ?

      googlesitekit_manage_module_sharing_options::["search-console"]: ?

      googlesitekit_manage_module_sharing_options::["analytics-4"]: ?

      googlesitekit_manage_module_sharing_options::["pagespeed-insights"]: ?

      googlesitekit_delegate_module_sharing_management::["search-console"]: ?

      googlesitekit_delegate_module_sharing_management::["analytics-4"]: ?

      googlesitekit_delegate_module_sharing_management::["pagespeed-insights"]: ?

    enabled_features:

      adsPax: ?

      audienceSegmentation: ?

      conversionReporting: ?

      gm3Components: ?

      privacySandboxModule: ?

      rrmModule: ?

      signInWithGoogleModule: ?

    active_conversion_event_providers:

      contact-form-7: contact

      woocommerce: add_to_cart, purchase

    consent_mode: enabled

    consent_api: detected

    search-console_shared_roles: none

    search-console_management: owner

    analytics-4_shared_roles: none

    analytics-4_management: owner

    pagespeed-insights_shared_roles: none

    pagespeed-insights_management: all_admins

    search_console_property: https://www.[site-name].com/

    ads_conversion_tracking_id: AW-1??????????

    analytics_4_account_id: 2656?????

    analytics_4_property_id: 3717853??

    analytics_4_web_data_stream_id: 5113??????

    analytics_4_measurement_id: G-7M????????

    analytics_4_use_snippet: yes

    analytics_4_ads_conversion_id: none

    analytics_4_available_custom_dimensions: googlesitekit_post_type

    analytics_4_ads_linked: true

    analytics_4_ads_linked_last_synced_at: 1728999391

    tagmanager_account_id: 6098??????

    tagmanager_container_id: GTM-T2B????

    tagmanager_amp_container_id: none

    tagmanager_use_snippet: yes
    ramya

    (@ramyasam)

    I am also facing the same issue after updating to new version.

    Thread Starter pk385

    (@pk385)

    Since my reply has been waiting moderation for almost 2 hours ill repost without the system info:

    @skalanter
    Not comfortable sharing the domain here, hope that’s understandable. Another thing I noticed when google fonts were failing to load on the frontend (opting not to serve from local): The weight was specified in the URL to the google fonts API, in my instance the family and weight were ‘Questrial’ and ‘700’ respectively. Google does not serve this font in 700 weight, only 400, causing an API error to be returned instead of the font file.

    I’m speculating that maybe the previous version handled this situation differently as setting 700 weight in the customizer resulted in the intended appearance with no errors, seemingly because the 700 weight is being set in the inline CSS instead of only, or also, being passed into the URL as a parameter when fetching the font from google.

    The only other plugins I have that touch google fonts are elementor pro and autoptimize. I immediately assumed autoptimize to be the culprit but adding the bypass parameter ‘ao_noptimize=1’ to bypass the plugin and load the normal CSS and JS yielded the same result. Also, all the instances of google fonts where elementor was doing the loading worked without issue.

    Shahin

    (@skalanter)

    Hello Everyone,
    Thank you for reaching out,

    @chordzillastatistics,
    Sorry to hear that. We have been announcing this update for over 2 months: blog articles, newsletter, social media, and have also made dev versions available for testing.
    I noticed you also mention a child theme. May I ask how did you create the child theme? Did you by any chance copy parent theme folder into the child theme? Or use custom PHP snippets for Google Fonts?
    What happens if you update (staging / localhost) and you switch to the parent theme, then clear cache thoroughly?
    Did you follow the steps shared above:
    1. Enable Google Fonts,
    2. Ensure fonts are hosted locally
    3. Choose correct font format for locally hosted fonts
    https://docs.oceanwp.org/article/896-customizer-typography#Google-Font-Settings-EPxsL

    @pk385
    Kindly note that we don’t handle comment moderation on this forum.
    You also mentioned a child theme, so I also need to ask you how did you create the child theme and whether you copied parent theme files into the child theme or any PHP snippets involving Google Fonts? What happens if you switch to the parent theme.
    Likewise, I noticed you are using Object Cache, WP Super Cache and Autoptimize at the same time, so clearing this cache might be really painful.
    If you create a staging site and follow the steps described earlier as well as these related to the child / parent theme, do the issues persist?

    Since you’ve mentioned a pro plugin, please note that we cannot solve/talk about the premium plugin according to the forum rules. Please read the forum guidelines: https://www.ads-software.com/support/guidelines/#do-not-post-about-commercial-products

    @ramyasam
    Would you please share a live URL and also provide use your system info?
    like a first reply on this thread. Because I see the number of requests has not increased, neither did the page size. Was cache cleared? And if they do it on a staging site, clear cache etc, then check in a couple of days, do they experience the same problem?

    Please keep us posted on the results,
    Hope it helps.
    Best Regards

    gtheodosiadis

    (@gtheodosiadis)

    i found out that enabling Google fonts and at the same time disabling local Google fonts option, solves the massive performance issue in the new theme version on my websites

    Thread Starter pk385

    (@pk385)

    @skalanter That wasn’t a dig at you guys, I know wordpress handles the comment moderation and I was just trying to get my idea of what could be happening through without waiting any longer.

    My child theme is the official one from the oceanwp website, It has 0 template overrides of the base theme and the only files are ones I myself created for custom functionality that doesn’t do anything with google fonts. A quick ctrl+f search for “font” in my functions.php yielded 1 result, custom code for changing the color of fonts for the stripe payment gateway plugin, so unrelated.

    Yes, clearing the cache can be annoying, but I did try clearing it multiple times. fastcgi cache, supercache page cache, autoptimize cache, memcache object cache, and cloudflare cache were all cleared/purged.

    To reiterate, this is where the issue comes from in my instance:

    4.0.0 is doing almost 90 HTTP requests for google fonts before serving each page, It’s trying to download a font variation(700 weight) that does not exist, and eventually gives up. The previous version 3.6.1 only downloads the default 400 weight font, one that would always be available, then uses CSS to set the weight.

    cpdesign123

    (@cpdesign123)

    Same problem here. Updated to 4.0 – Font’s won’t load correctly. Turned on Enable Google Fonts and now site won’t load at all – get timeouts. Site has been fine for years and now this. Rolling Back.

    Thread Starter pk385

    (@pk385)

    Looking at the theme code, I see the issue.

    4 months ago changes were made to the oceanwp_enqueue_google_font function that are not present in the previous version.
    3.6.1:

     // Weights
    $weights = array( '100', '200', '300', '400', '500', '600', '700', '800', '900' );
    $weights = apply_filters( 'ocean_google_font_enqueue_weights', $weights, $font );
    $italics = apply_filters( 'ocean_google_font_enqueue_italics', true );

    // Main URL
    $url = '//fonts.googleapis.com/css?family=' . str_replace( ' ', '%20', $font ) . ':';

    // Add weights to URL
    if ( ! empty( $weights ) ) {
    $url .= implode( ',', $weights ) . ',';
    $italic_weights = array();
    if ( $italics ) {
    foreach ( $weights as $weight ) {
    $italic_weights[] = $weight . 'i';
    }
    $url .= implode( ',', $italic_weights );
    }
    }

    Now, 4.0.0:

    // Weights
    $weights = array( '100', '200', '300', '400', '500', '600', '700', '800', '900' );
    $weights = apply_filters( 'ocean_google_font_enqueue_weights', $weights, $font );
    $italics = apply_filters( 'ocean_google_font_enqueue_italics', true );

    // Main URL
    $url = '//fonts.googleapis.com/css?family=' . str_replace( ' ', '%20', $font ) . ':';

    if ( isset( $variant_value ) && '' !== $variant_value ) {
    $variant = $variant_value;
    $url .= $variant;
    }
    else if ( ! empty( $weights ) ) {
    $url .= implode( ',', $weights ) . ',';
    $italic_weights = array();
    if ( $italics ) {
    foreach ( $weights as $weight ) {
    $italic_weights[] = $weight . 'i';
    }
    $url .= implode( ',', $italic_weights );
    }
    }

    If a specific font variant is passed to this function, It will short-circuit and attempt to download only the passed variant, instead of attempting the full range of weights.

    This means, if I select a font weight of 700 in the customizer, it will ONLY attempt to download the 700 weight font variant from google. If google does not have a 700 weight variant to serve, an API error is returned, and it’s stuck in this loop of trying to download a non-existing variant until giving up.

    Thread Starter pk385

    (@pk385)

    Remediation time!!!

    We can either…

    • Revert to the previous behavior of attempting the full range of weights (Always More requests)
    • Always download the 400/Regular weight font even if a variant is passed (Always 1 extra request)
    • Create a fallback mechanism when the specific variant fails to download and attempt the full range (Has to wait to fail, then more requests)
    • Create a fallback mechanism when the specific variant fails to download and instead download the 400/Regular weight as a stop-gap (Has to wait to fail, then 1 extra request)
    chordzillastatistics

    (@chordzillastatistics)

    @skalanter

    I’m using a child theme that I downloaded from your site.

    OceanWP Child Theme

    Ready-to-Use Child Theme for the OceanWP free WordPress theme. Usage

    Download the child theme zip file. Upload the zip (oceanwp-child-theme-master.zip) under your WordPress dashboard, Appearance > Themes.The other method would be to extract files and upload via FTP at wp-content/themes/. Renaming

    You can rename the zip file so it isn’t called oceanwp-child-theme-master.zip.
    You can also change the “Theme Name” at the top of the style.css file, as well as the rest of information in the same file. This is called whitelabeling a child theme.

    I haven’t made any changes to the fonts. Everything started after the theme’s automatic update. After reverting to the previous version, the issue disappeared, and the site became fast again. However, some settings in the admin panel were lost, so I had to return to the new version.

    Now, I’ve just disabled Google Fonts and linked the necessary fonts locally.

    Everything is fine now, so you can focus on other users with similar issues. I don’t plan on going back to using Google Fonts with this theme; I’m hesitant to do so now.

    Thread Starter pk385

    (@pk385)

    @chordzillastatistics and anyone else wanting to stick with 4.0.0 and fix this issue instead of rolling back, you can likely edit the oceanwp_enqueue_google_font() function from /wp-content/themes/oceanwp/inc/customizer/webfonts.php (Link to file in GitHub) starting at line 120 and remove this font variant code:

    	if ( isset( $variant_value ) && '' !== $variant_value ) {
    $variant = $variant_value;
    $url .= $variant;
    } else if ( ! empty( $weights ) ) {
    $url .= implode( ',', $weights ) . ',';
    $italic_weights = array();
    if ( $italics ) {
    foreach ( $weights as $weight ) {
    $italic_weights[] = $weight . 'i';
    }
    $url .= implode( ',', $italic_weights );
    }
    }

    So that the code block looks like this:

    	if ( ! empty( $weights ) ) {
    $url .= implode( ',', $weights ) . ',';
    $italic_weights = array();
    if ( $italics ) {
    foreach ( $weights as $weight ) {
    $italic_weights[] = $weight . 'i';
    }
    $url .= implode( ',', $italic_weights );
    }
    }

    I have not tested this, but this is exactly how 3.6.1 handles the weights.

    Thread Starter pk385

    (@pk385)

    @skalanter

    Might want to forward this one to the devs too

Viewing 15 replies - 1 through 15 (of 18 total)
  • You must be logged in to reply to this topic.