Ive searched and can't find an answer. I have two groups of fonts - one regular fonts and one google fonts. Im using a select dropdown list with two optgroups, one for each group of fonts. What Im trying to accomplish is to load the script for google fonts on the front-end only if a font is selected under that optgroup label. Im able to get the value of the font-family selected in the option, but not the optgroup. I'll attach a screenshot of the dropdown in the admin area.
optgroup
s are not stored anywhere. There's no way to know which group a selection belongs to. You'll need to keep a list of which selections are Google Fonts and load the script based on hat. – Jacob Peattie Apr 14 '20 at 8:04