Why can't I enqueue multiple Google Fonts in WordPress functions.php?

This actually has to do with PHP and the way it parses query parameters.

https://www.php.net/manual/en/function.parse-str.php

In any case, the current workaround is to pass "null" to the version parameter to have WordPress not add a "ver" to the URL.

wp_enqueue_style( 'google-fonts', 'https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300;0,400;0,700;1,400&family=Neuton:ital,wght@0,300;0,400;0,700;1,400&display=swap', [], null );

That ending "null" will eliminate the problem, since WordPress won't try to add any additional parameters to the URL, thus not running it through PHP's query string handling functions.

This may be addressed more directly in a future WordPress update. However, having no version on these external URLs makes sense regardless.


The same query parameter is defined twice (family) so WordPress removes one. This is a normal thing in a typical context: if there is a repeated query parameter, only the last one is used. WordPress makes use of this "rule" when enqueuing the URL.

I can't tell you why Google Fonts changed the syntax from the | separator (like so: https://fonts.googleapis.com/css?family=Montserrat|Neuton&display=swap) to this repeated family parameter, but it looks like it might be because of the complexity like you see in your URL. One thing is for sure: this is going to cause some trouble like you're running into now. Either WordPress will need to adjust for this, or Google Fonts will have to update/revert their URL syntax. This probably won't happen today.

In this case, you're better off making the change yourself for now, by using the Classic Site (in the Google Fonts navbar) to build out your font URL instead. I know you won't get as many options (looks like you're trying to use variable fonts, which are fantastic!), so it is a bit disappointing.

You can, alternatively, download the files and self-host these fonts. It's a performance boost in many cases, too.