Block Editor PHP Beginner

Turn Off Drop Caps and Custom Typography

Remove the drop cap toggle and custom letter spacing, text decoration and font style controls from paragraphs.

Tested on WordPress 7.1 PHP 8.3 No plugin needed Updated
functions.php 13 lines
add_filter( 'wp_theme_json_data_theme', function ( $theme_json ) {
	return $theme_json->update_with( [
		'version'  => 3,
		'settings' => [
			'typography' => [
				'dropCap'        => false,
				'letterSpacing'  => false,
				'textDecoration' => false,
				'fontStyle'      => false,
			],
		],
	] );
} );

Where to add this

Recommended A code snippets plugin Survives theme changes and is easy to switch off.
Child theme At the end of your child theme's functions.php file.
Must-use plugin As a .php file in wp-content/mu-plugins, starting with <?php.

Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.

Drop caps, custom letter spacing and font style overrides are easy to overuse. On sites with a set typography system, removing them keeps posts consistent.

How it works

The wp_theme_json_data_theme filter changes your theme’s theme.json settings from PHP. Turning off dropCap removes the paragraph drop cap toggle; letterSpacing, textDecoration and fontStyle remove those controls from the typography panel.

Things to watch

  • Paragraphs that already use a drop cap keep it.
  • This works with classic and block themes.

How to test it

Select a paragraph and open Typography in the sidebar. The Drop cap option should be gone.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only