The WPFolks app is out on iPhone and Android. Free, no ads. Download on the App Store Get it on Google Play
Skip to main content
Login Join
Snippet · PHP

Add Custom Font Sizes to Gutenberg Editor

Shared by Amit Dholiya · July 23, 2026 · @add_theme_support()

2 copies
53 views
1 upvote
Back to Snippets

This snippet allows you to define custom font sizes in the Gutenberg block editor. The selected sizes will appear in the Typography settings for text-based blocks, helping maintain consistent typography across your website.

Steps

  1. Open your theme’s functions.php file or a custom plugin.
  2. Add the code below.
  3. Save the file and clear any caches.
  4. Open the Gutenberg editor and check the Font Size options.
add_theme_support(
    'editor-font-sizes',
    array(
        array(
            'name' => __( 'Small', 'textdomain' ),
            'size' => 14,
            'slug' => 'small'
        ),
        array(
            'name' => __( 'Medium', 'textdomain' ),
            'size' => 18,
            'slug' => 'medium'
        ),
        array(
            'name' => __( 'Large', 'textdomain' ),
            'size' => 24,
            'slug' => 'large'
        ),
        array(
            'name' => __( 'Extra Large', 'textdomain' ),
            'size' => 36,
            'slug' => 'extra-large'
        ),
    )
);
Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

0 comments