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
Hi,
The fix for this will be released in the upcoming update.
Best regards
Thank you!