Local font regeneration creates duplicate regular fonts from checkbox metadata

Hello.

I’ve identified two issues with locally cached Google Fonts in BeTheme 28.5.9.1.

1. Checkbox metadata is treated as a font weight

With Ubuntu weights 400, 500 and 700 selected, regenerating local fonts also created Ubuntu-1-latin.woff2 and its Latin Extended equivalent. These were declared as weight 400, duplicating the regular font. The same happened with Poppins.

The checkbox renderer in muffin-options/fields/checkbox/field_checkbox.php adds a hidden [post-meta] value of 1.

In functions/builder/class-mfn-builder-ajax.php, _tool_regenerate_fonts() reads the font-weight array and iterates over its values without excluding this marker. It consequently requests weight 1 and uses that value in the generated filenames.

For testing, I added:

unset($weight['post-meta']);

Immediately after:

$weight = mfn_opts_get( 'font-weight', ['400'] );

After regeneration, the duplicate Ubuntu-1 and Poppins-1 declarations disappeared, leaving the expected weights.

This also affected performance: WP Rocket preloaded Ubuntu-400, while the browser downloaded Ubuntu-1 through the later CSS declaration, resulting in two regular-font downloads.

Could you exclude checkbox metadata and validate the weight values in the generator?

2. Regenerated frontend font CSS retains a fixed version

In functions/theme-head.php, the local stylesheet is enqueued with true as its version:

wp_enqueue_style('mfn-local-fonts', wp_normalize_path($path_fonts.'/mfn-local-fonts.css'), '', true);

This produces mfn-local-fonts.css?ver=1, which remains unchanged after regeneration. On our aggresively cached site, the original URL continued returning older CSS, while changing the query-string version returned the updated content.

Could this use the generated file’s modification time, or another version updated during regeneration, to invalidate cached copies reliably?

I understand Poppins is included for the theme’s admin/builder interface, so its inclusion is not the issue being reported.


Thank you.

Comments

Sign In or Register to comment.
This website uses cookies

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.

Cookies are small text files that can be used by websites to make a user's experience more efficient.

The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies we need your permission. This means that cookies which are categorized as necessary, are processed based on GDPR Art. 6 (1) (f). All other cookies, meaning those from the categories preferences and marketing, are processed based on GDPR Art. 6 (1) (a) GDPR.

This site uses different types of cookies. Some cookies are placed by third party services that appear on our pages.

You can at any time change or withdraw your consent from the Cookie Declaration on our website.

Learn more about who we are, how you can contact us and how we process personal data in our Privacy Policy.

Please state your consent ID and date when you contact us regarding your consent.