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;

Why use React/JS to create a Meta Box

In my previous post I mentioned that the reason why we need to learn to do this is to get all the new features. But what is the new features?

You can read more in my previous post: Custom Field & Meta Box in Gutenberg Editor.

In this short blog post, I want to give a simple example, to transform the field to a full sidebar panel.

Read More Why use React/JS to create a Meta Box

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

How to Create Valid SSL in localhost for XAMPP

Chrome browser updates has become a burden for local development. Not only they decided to disable .dev domain for local development, they also really have specific configuration in SSL Cert to show the site as secure.

In this step by step tutorial I will try to explain  the walk-through to create SSL cert locally to be used in XAMPP in Windows.

Read More How to Create Valid SSL in localhost for XAMPP