From the wp_enqueue_style()
documentation:
$ver
(string|bool|null) (Optional) String specifying stylesheet version number, if it has one, which is added to the URL as
a query string for cache busting purposes. If version is set to false,
a version number is automatically added equal to current installed
WordPress version. If set to null, no version is added.Default value: false
So when the version number is not exactly a null
(i.e. $ver !== null
), WordPress uses add_query_arg()
to add the version number and because the function supports only one instance of the same query string (except for arrays like family[]
and foo_bar[]
), the previous family
queries in the stylesheet URL are removed by add_query_arg()
.
Therefore, you can either enqueue the font families one per wp_enqueue_style()
call (like you’ve tried), or set the $ver
to null
(and manually add the version number or cache buster query):
wp_enqueue_style( 'get-google-fonts', 'https://fonts.googleapis.com/css2?family=Alata&family=Baloo+Tamma+2&family=Roboto:wght@100&display=swap', array(), null );