The best way to access icon metadata is using the GraphQL API.
If you are using this plugin, there is also a a PHP API for a query()
function that adds some convenient wrapping around requests to the GraphQL API.
There’s also a WordPress REST API endpoint which exposes that query() function to clients of the WordPress API, like JavaScript clients. (This plugin’s own settings page uses it, for example.)
A benefit of using this plugin’s query()
API for handling those GraphQL queries is that it also adds authentication to those query requests if the web site owner has added an API Token for accessing their Font Awesome accounts. Today, adding account authentication to a GraphQL query wouldn’t make any difference in the icon metadata results, because none of those results are account-specific. But I expect that in the future–when Icon Upload is released–this will be the best way to retrieve account-specific metadata that includes the user’s custom icons.
As for how your theme users incorporate Pro, you may already be aware of this, but Font Awesome’s licensing does not permit redistribution of the icon assets. So if the installation method were self-hosted (such as when the assets are copied to the WordPress server and hosted from there), then it would require that the theme user has their own license of Font Awesome Pro and goes through the steps to upload the relevant files for self-hosting. That can be tedious and error-prone for some users, and I think it would almost always result in slower loading of icon assets.
By contrast, this plugin will always load assets from the Font Awesome CDN, so no file management required on the WordPress server, always immediate access to the latest and greatest icons, and worldwide performance optimization on the CDN.
In either case–whether self-hosting Pro assets or loading Pro assets via the CDN–the metadata for all of Free and Pro for all versions is freely available via the GraphQL API.
So, if your theme were integrated with this plugin, the user would choose their version of Font Awesome using the Font Awesome settings page. Your theme could use this plugin’s PHP API to discover details about the Font Awesome configuration, such as whether Pro is enabled, and then use the query()
API to provide the user with icon metadata relevant to the version and license of Font Awesome that they’ve configured.
(Hint: you can also run fuzzy searches through the same Algolia search that powers the Icon Gallery on fontawesome.com, through the same GraphQL API.)
Does that help?