In WordPress 7.0, two new typography settings arrived within the block editor to set a line indentation and use the “Fit text” feature. The latter already has been part of WordPress 6.9 as block style. For me, such settings are usually not necessary for most people. Thus I show you how you can remove them in your theme.

Functionality description

The line indentation is used to indent the first line of a paragraph. This is usually been done in books and similar and not widespread on the internet.

The fit text feature automatically adjusts the font size of the text to match the whole available space of a single line. Thus, the text will never break into a new line. This may look cool, but depending on the text length can either be very big on desktop or very small on mobile devices.

Line indent and fit text settings in the block editor

Both settings can be found in the typography panel within the styles tab of supported blocks. For line indent, it works on paragraph blocks, while fit text is available for paragraph as well as heading blocks.

Remove the features

Line indentation can be removed via the theme.json by setting settings.typography.textIndent to false:

{
    "$schema": "https://schemas.wp.org/wp/7.0/theme.json",
    "version": 3,
    "settings": {
        "typography": {
            "textIndent": false
        },
    }
}Code language: JSON / JSON with Comments (json)

Fit text on the other hand can currently only disabled by filtering the block supports of the particular blocks via PHP:

function disable_fit_text_blocks( array $metadata ): array {
    $blocks = [ 'core/paragraph', 'core/heading' ];
    
    if ( \in_array( $metadata['name'], $blocks, true ) ) {
        $metadata['supports']['typography']['fitText'] = false;
    }
    
    return $metadata;
}

\add_filter( 'block_type_metadata', 'disable_fit_text_blocks' );Code language: PHP (php)

Afterwards, these settings are no more available in the typography styles settings.

Likes

Reposts

Leave a Reply

Your email address will not be published. Required fields are marked *

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Learn more about webmentions)