Hello, I do recognize what is going on here but I am unsure *where* the fix is.
When you change the “Return Value” settings in an ACF field you are telling ACF how you want the value back. And so long as you use ACF functions to retrieve that value like get_field()
or get_sub_field()
, you will get the specified return value format.
But if you get the value another way, you are bypassing that ACF functionality and you will instead get the raw value from the database. I’ve seen this happen with other users of my plugin who are using get_post_meta()
to retrieve their values.
The fact that it used to work in your implementation with FontAwesome 5.x icons is actually a coincidence. You are looking for just the plain icon class, and that is how 5.x icons are stored in the database. So the raw DB value that was being returned happened to match what you needed/wanted. FontAwesome 6.x icons are a lot more complex and I’ve had to store more data in the database which is why that is no longer the case.
I am not a WP GraphQL user so I’m not familiar with how that plugin handles value formatting. Many of the ACF ‘core’ field types also have different return value options that I am guessing WP GraphQL already handles properly. It is likely that because my field is a third party field type it just has not been considered. Maybe they do not consider 3rd party fields as a matter of policy. Which would leave either a filter function that would go in your functions.php, or perhaps for future inclusion in my plugin.
Skimming the docs here: https://acf.wpgraphql.com/ I see this in their FAQ
- I have an ACF Extension that adds a new field type, will it work with WPGraphQL for ACF?WPGraphQL for ACF supports the field types that come with ACF (Free and PRO) as well as the field typs in ACF Extended (Free and PRO). Support for additional field types can be added by using the “register_graphql_acf_field_type” API.
If this is something you experiment with, please share your results here. If WPGraphQL doesn’t want to support this field type natively perhaps this plugin could register itself.