From eb2d907b3e4d786ef967540cde50e0ee439b7fd9 Mon Sep 17 00:00:00 2001 From: David Baumwald Date: Tue, 4 Oct 2022 16:45:25 +0000 Subject: [PATCH] Editor: Fix server-side attribute registration via typography support. Ensures the `fontFamily` attribute is registered for block types on the server side. This change resolves a `400` error when attempting to change the font family for a server-side rendered block in the editor. Props aaronrobertshaw, mamaduka, wildworks, upadalavipul. See #56467. git-svn-id: https://develop.svn.wordpress.org/trunk@54387 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/block-supports/typography.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/wp-includes/block-supports/typography.php b/src/wp-includes/block-supports/typography.php index bd91bcfe76..9d947088e2 100644 --- a/src/wp-includes/block-supports/typography.php +++ b/src/wp-includes/block-supports/typography.php @@ -57,6 +57,12 @@ function wp_register_typography_support( $block_type ) { 'type' => 'string', ); } + + if ( $has_font_family_support && ! array_key_exists( 'fontFamily', $block_type->attributes ) ) { + $block_type->attributes['fontFamily'] = array( + 'type' => 'string', + ); + } } /**