You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using wp_deregister_font_family() (and I assume wp_deregister_font_variation() although I've not tested that) to attempt to deregister fonts that have been registered by theme.json the fonts remain.
We have done the following to remove fonts from theme.json which works nicely ...
Note that array_values() has to be used to re-order the theme array keys otherwise an error is observed in the site editor.
I'm not entirely sure how this would fit in with the wp_deregister_font_family() and wp_deregister_font_variation() functions but it's a start.
Step-by-step reproduction instructions
Add the following in a custom plugin when using Twenty Twenty-Three theme ...
function init_wp_deregister_font_family() {
$font_family_handles = array('dm-sans', 'ibm-plex-mono', 'inter', 'system-font', 'source-serif-pro');
foreach ($font_family_handles as $font_family_handle) {
wp_deregister_font_family($font_family_handle);
}
}
add_action('init', 'init_wp_deregister_font_family');
Expected behaviour is that the "Dashboard - Appearance - Editor - Styles - Typography - Text - Typography" dropdown will not show and no font CSS / files will be enqueued because no fonts should be registered but the dropdown, CSS and files remain.
The Fonts API will be removed and replaced by Font Face (which is in trunk) when the Fonts Library is merged. Font Face does not have a register, enqueue, or remove (deregister, etc). Thus, this issue can be closed.
Description
When using
wp_deregister_font_family()
(and I assumewp_deregister_font_variation()
although I've not tested that) to attempt to deregister fonts that have been registered bytheme.json
the fonts remain.We have done the following to remove fonts from
theme.json
which works nicely ...Note that
array_values()
has to be used to re-order the theme array keys otherwise an error is observed in the site editor.I'm not entirely sure how this would fit in with the
wp_deregister_font_family()
andwp_deregister_font_variation()
functions but it's a start.Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: