Support » Developing with WordPress » Problem with editor font sizes in WP 6.1

  • Resolved SkyMaja

    (@skymaja)


    Hi, this is my code, which used to work correctly in WP 6.0.2

    add_theme_support(
    			'editor-font-sizes',
    			array(
    				array(
    					'name'      => esc_html__( 'XS', 'mywebsite' ),
    					'shortName' => esc_html_x( 'XS', 'Font size', 'mywebsite' ),
    					'size'      => 14,
    					'slug'      => 'extra-small',
    				),
    				array(
    					'name'      => esc_html__( 'S', 'mywebsite' ),
    					'shortName' => esc_html_x( 'S', 'Font size', 'mywebsite' ),
    					'size'      => 16,
    					'slug'      => 'small',
    				),
    				array(
    					'name'      => esc_html__( 'M', 'mywebsite' ),
    					'shortName' => esc_html_x( 'M', 'Font size', 'mywebsite' ),
    					'size'      => 18,
    					'slug'      => 'normal',
    				),
    				array(
    					'name'      => esc_html__( 'L', 'mywebsite' ),
    					'shortName' => esc_html_x( 'L', 'Font size', 'mywebsite' ),
    					'size'      => 30,
    					'slug'      => 'large',
    				),
    				array(
    					'name'      => esc_html__( 'XL', 'mywebsite' ),
    					'shortName' => esc_html_x( 'XL', 'Font size', 'mywebsite' ),
    					'size'      => 40,
    					'slug'      => 'extra-large',
    				),
    			)
    		);
    

    and here you can see how it looks like now in editor: https://ibb.co/2383bvh

    As you can see, there is no px value. Only name of font size, which isn’t the same as on button.

    If I choose for example L on button, the has-normal-font-size class is applied. So it works like it used to be, only labels on the buttons are incorrect (and missing px value).

    Is it a bug in WP 6.1 or do I have to change something? What exactly? I didn’t find any information about this in field guide.

    I don’t have theme.json and don’t want to add it now.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I suspect it has to do with this bug here: https://github.com/WordPress/gutenberg/issues/44245 – if you have further questions about it, I would recommend you to contact the Gutenberg developers there.

    Thread Starter SkyMaja

    (@skymaja)

    Thanks, yes, it’s that issue. Interesting, that author of this issue has problem in WP 6.0.2 and I’m pretty sure that it used to work correctly on my website, until I updated to 6.1.
    Currently I solved this by adding 6th font size. If they are at least 6, they display correctly in a dropdown instead of a row.

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