Closed bobbingwide closed 2 years ago
In s.b/hm the font family is defined in some inline CSS for body
.
font-family: var(--wp--preset--font-family--lato);
This isn't present in herbmiller.me.
Looks like it's a bug with WordPress 5.8 and Gutenberg. https://github.com/WordPress/gutenberg/issues/33681
In the live site (herbmiller.me) the $result of WP_Theme_JSON_Gutenberg Object::get_merged_data()
contains
[typography] => Array
[fontFamily] => (string) "var:preset|font-family|lato"
[lineHeight] => (double) 1.625
For other elements the var has already been resolved. For example, styles.color.background = "var(--wp--preset--color--body-background)"
In s.b/hm
the value is as expected.
[typography] => Array
[fontFamily] => (string) "var(--wp--preset--font-family--lato)"
[lineHeight] => (double) 1.625
In the live site the value changes from the correct version to the incorrect version
bw_trace2( $result, "GMD result 1" );
if ( 'user' === $origin ) {
$result->merge( self::get_user_data() );
}
bw_trace2( $result, "GMD result 2" );
Commenting out the merge doesn't resolve the issue. The value is OK in the trace output but the font-family CSS is not generated on the body.
Well, there you go. In the live site WP_DEBUG
was false
.
Setting it to true resolved the problem.
But at the same time it resurfaced the following notice.
Notice: Undefined offset: 0 in /home/customer/www/herbmiller.me/public_html/wp-includes/block-supports/elements.php on line 51
which also results in the unexpected HTML previously reported for the sb-post-edit-block when the user is not logged in.
But at the same time it resurfaced the following notice.
Resolved by updating sb-post-edit-block to v0.2.0, which contains a workaround.
In the live site WP_DEBUG was false. Setting it to
true
resolved the problem.
I reproduced the problem in my local development environment ( 's.b/hm' ) by setting WP_DEBUG to false.
Aside: When WP_DEBUG
is true
the default font can be overridden by the Global Styles in the Site Editor.
Investigating further. The problem occurs in gutenberg_experimental_global_styles_get_stylesheet()
which returns the $cached
information from get_transient( 'global_styles');
when $can_use_cached
is true
....
and $can_use_cached
can only be true when both WP_DEBUG
and SCRIPT_DEBUG
are false
( or not set) and it's not a REST_REQUEST
and it's not is_admin()
.
So, if I set the wp-config values to false and log out it should work OK. Right?
Closing. URP in s.b/hm with WordPress 6.0 and Gutenberg 13.3.0
There's something wrong with the font families on herbmiller.me. They're OK on
s.b/hm
.