Author: David

I'm David, web designer/developer specializing in building functional websites using WordPress. I have strong skills in theme development using Hybrid Core framework and plugin development. It's okay if you want to hire me.

A school should not
Be an ivory tower or a museum,
Nor like an office,
Or a service station for motorcars;
But a frontier post.

How To Disable Typography Option in WordPress 5.9

It’s very simple to disable it, you can simply drop this in your theme functions.php or add it in your plugin.

add_action(
	'after_setup_theme',
	function() {
		add_theme_support( 'editor-font-sizes', [] );

		add_filter(
			'block_editor_settings_all',
			function( $editor_settings, $context ) {
				$editor_settings['__experimentalFeatures']['typography']['fontWeight'] = false;
				$editor_settings['__experimentalFeatures']['typography']['letterSpacing'] = false;
				$editor_settings['__experimentalFeatures']['typography']['textTransform'] = false;
				$editor_settings['__experimentalFeatures']['typography']['fontStyle'] = false;
				return $editor_settings;
			},
			10,
			2
		);
	}
);

How to Disable Drop Cap Settings?

You can simply add this code:

$editor_settings['__experimentalFeatures']['typography']['dropCap'] = false;

Custom Field & Meta Box in Gutenberg Editor

How to do this in the “new” way?

From this:

To this:

Creating a custom field using a custom meta box is simple and very straightforward.

Basically we create a meta box using meta box API and add it in post meta data using save_post hook.

Here’s the basic code:

// Add field:
add_action( 'add_meta_boxes', function() {
	add_meta_box(
		'my_meta_box',
		'My Meta Box',
		function( $post ) {
			wp_nonce_field( __FILE__, '_my_data_nonce' );
			?>
			<p><input type="text" class="large-text" name="my_data" value="<?php echo esc_attr( get_post_meta( $post->ID, '_my_data', true ) ); ?>"></p>
			<?php
		},
		'post',
		'side'
	);
} );
// Save field.
add_action( 'save_post', function( $post_id ) {
	if ( isset( $_POST['my_data'], $_POST['_my_data_nonce'] ) && wp_verify_nonce( $_POST['_my_data_nonce'], __FILE__ ) ) {
		update_post_meta( $post_id, '_my_data', sanitize_text_field( $_POST['my_data'] ) );
	}
} );

But how to do this in the new way?

Read More Custom Field & Meta Box in Gutenberg Editor