Error with "Preload Local Fonts" in Kadence theme

When I enable “Load Google font locally” and “Preload Local Fonts” in Kadence theme (General/Performance), I got this error :

Fatal error: Uncaught Error: Maximum function nesting level of ‘256’ reached, aborting! in […]/app/public/wp-includes/class-wp-object-cache.php on line 493

Local v5.10.3+5332 on Linux (Manjaro)

That’s an error that I’ve seen related to Xdebug. You should be able to uncrease the number so that you can use those features of the Kadence theme:

Basically, you should be able to open the site-name/conf/php/php.ini.hbs file for the site and add a line like this to the xdebug section:

xdebug.max_nesting_levels=500

In the above screenshot I have 500, but you could go higher. Just add that value, and restart the site in Local so that those settings are re-compiled and used.

The only thing to consider is that this setting is in place because when running Xdebug, the PHP application uses much more memory, which means that a function (and by extension a stacktrace) that is nested more than 256 times will take up a lot of memory.

Higher values aren’t “bad,” but if you aren’t careful, your computer could crash or have performance issues because this site is using too much ram.

Thank you for your answer!

Why not turn off Xdebug instead ? I don’t even know what it is so I probably don’t need it…

Or maybe loading the google font with a code snippet like here

Thank’s again!

That’s probably another option. Xdebug is a development tool which gives a lot more information about PHP errors. Usually Xdebug isn’t activated, or has limited options in a production environment, but in a dev environment like Local, it can be really helpful in zeroing in quickly on where a problem is occuring.

This help doc goes into more detail about some of the specific things that Xdebug is doing when enabled:

If you don’t need those kinds of features, then you can definitely disable Xdebug.

Thank you for the answer!
Other than adding a few code snippets, I don’t really develop in PHP. And I could always turn it on if needed.

1 Like

I tried with xdebug.max_nesting_levels=1000 or xdebug.remote_enable=0 but nothing changes.
I also noticed that my site doesn’t sthow he same fonts on firefox and chrome ?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.