[wp-trac] [WordPress Trac] #49742: No longer able to enqueue multiple Google Fonts with wp_enqueue_style

WordPress Trac noreply at wordpress.org
Tue Mar 31 16:03:07 UTC 2020


#49742: No longer able to enqueue multiple Google Fonts with wp_enqueue_style
--------------------------+-----------------------------
 Reporter:  tannerm       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I'm using wp_enqueue_style to enqueue this Google Font file. Here is my
 code:

 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',
 [] );

 This is in my functions.php file.

 However, when I view source on my loaded page, the URL for that font file
 is cut down to:
 https://fonts.googleapis.com/css2?family=Neuton%3Aital%2Cwght%400%2C300%3B0%2C400%3B0%2C700%3B1%2C400&display=swap&ver=5.3.2

 As you can see, the first family param has been removed after being
 outputted through wp_enqueue_style. Is there a way to fix this without
 doing anything hacky? I think there may be an outdated way to build the
 URL to both to come through, but I'd rather be able to use what Google now
 provides. My original URL inside wp_enqueue_style is the URL generated by
 Google Fonts for me to embed.

 SO post here: https://stackoverflow.com/questions/60953810/why-cant-i
 -enqueue-multiple-google-fonts-in-wordpress-functions-
 php/60954323#60954323

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49742>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list