Find out in this tutorial how to fix the bug that causes the large font size to display at a larger size in WordPress 5.9.
Have you upgraded to WordPress 5.9 and suddenly some texts look bigger than they should? Specifically the ones you had set as “Large” in the block editor, right?
Well, it’s not just you, it’s a known bug that I hope they will fix in WordPress version 5.9.1, but that may take a few weeks yet.
The bug affects themes that have defined font sizes (using
add_theme_support( 'editor-font-sizes', array() );)
Due to a change (introduced for theme.json file operation) the large font size is defined and forced to 36 pixels, regardless of what the theme has defined.
That is, even if you see that the selector indicates 20, on the front of the web it will be rendered at 36 pixels.
Let’s see how to fix it for now.
Snippet to fix large font size bug introduced in WordPress 5.9
To fix the bug you have to redefine the CSS variable that controls the font size when the large font option is selected.
Add the following to the theme’s style.css file:
In this case, you are telling the small version to be 14 pixels and the large version to be 20 pixels. But the idea is that you adjust it to what your theme has defined.
If you prefer, you can add it to the section where you have defined the
body, but as this is a transitional solution I would leave it aside to remove it once the WordPress version that corrects the error is released.
If you have found that in some themes some texts look bigger than they should after the update to WordPress 5.9, now you know how to fix it with code.
Any questions? I read you in the comments.
And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉