2 Answers
2

Wouldn't a better solution be to build your own list of available fonts, and then let the user select which font to use? That way, your validation is much easier, and also, you have more control over how you use/implement the specific setting.

In any case, you should be able to do what you want, within your sanitization callback, where you will (presumably) be ensuring that the input string is sanitized and validated (i.e. that the string actually corresponds to a Google web font name).

I ran in to this question while looking for something completly different. Also I know the question is already 2 years old. But since I have been coding/working with Google Fonts in Wordpress alot, I have come to realize:

There is no need to replace the + in the link. On all browsers I tested the link works with a space too. In my php page where I load additional css and styles I just use: