# Tighter, Bolder Headings Through theme.json

> Sets the weight, line height and letter spacing of all headings in a block theme, for a crisper, more modern look in the editor and on the site.

- Type: PHP
- Runs: Run everywhere
- Category: [Block Editor](https://wpide.com/library/category/gutenberg/)
- Tags: theme-json, headings, typography
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/themejson-heading-styles/

## Code

```php
// Heading typography.
$wpide_heading_weight         = '700';
$wpide_heading_line_height    = '1.15';
$wpide_heading_letter_spacing = '-0.02em';

add_filter( 'wp_theme_json_data_theme', function ( $theme_json ) use ( $wpide_heading_weight, $wpide_heading_line_height, $wpide_heading_letter_spacing ) {
    return $theme_json->update_with( array(
        'version' => WP_Theme_JSON::LATEST_SCHEMA,
        'styles'  => array(
            'elements' => array(
                'heading' => array(
                    'typography' => array(
                        'fontWeight'    => $wpide_heading_weight,
                        'lineHeight'    => $wpide_heading_line_height,
                        'letterSpacing' => $wpide_heading_letter_spacing,
                    ),
                ),
            ),
        ),
    ) );
} );
```

## Notes

Adjust the three values at the top. Individual blocks can still override them.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Tighter, Bolder Headings Through theme.json" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
