Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Okay, so as @rajeshml mentioned, the issue was with our theme–which was immediately seen upon switching to the standard 2024 theme.

    To fix the issue, open up your theme.json file within your theme wp-content/themes/whatever-theme/theme.json. Under settings > typography > fontFamilies there will be a number of font-object elements (the first key seems to always be “fontFace”).

    After each “fontFace” key you probably (like we did) only have “fontFamily” and “slug” keys. So you will need to add the “name” key to each font–which will probably contain the same (or nearly the same) text as the “fontFamily” key.

    As an example (for the Noto Serif font), the old entry might look something like this:

     {
    "fontFace": [
    {
    "fontFamily": "Noto Serif",
    "fontStyle": "normal",
    "fontWeight": "100",
    "src": [
    "file:./assets/fonts/noto-serif/noto-serif_normal_100.ttf"
    ]
    },
    ...
    ...
    "fontFamily": "Noto Serif",
    "slug": "noto-serif"
    },

    But it needs to have the “name” key added like so (notice the second-last line):

     {
    "fontFace": [
    {
    "fontFamily": "Noto Serif",
    "fontStyle": "normal",
    "fontWeight": "100",
    "src": [
    "file:./assets/fonts/noto-serif/noto-serif_normal_100.ttf"
    ]
    },
    ...
    "fontFamily": "Noto Serif",
    "name": "Noto Serif",
    "slug": "noto-serif"
    },

    I’m not sure if the cause of this issue is in WordPress not generating the right keys, or if our theme was just carrying over some really old data. But either way, this should solve your problem.

    Hey,

    I just encountered this error on our website–it was significantly slowing down the WooCommerce store. I haven’t looked too deeply into the cause yet, but for us, changing line 188 from:

    if ( $font['name'] === $font_to_add['name'] ) {

    To:

    if ( $font['fontFamily'] === $font_to_add['name'] ) {

    Fixed the error. It seems the entries within the $font_data that the containing function collects, lack a “name” element; but the “fontFamily” key represents the same thing, so it seems to be a valid substitute. I’ll have to check to see if our theme is causing the loss of the “name” key, or if it was never there to begin with.

Viewing 2 replies - 1 through 2 (of 2 total)