I know this is well beyond the scope of GeneratePress, but hoped the community might have some insights that could help me solve an issue I’m having with a REST API reply and a custom field.
In short I’ve created a custom REST API endpoint that serves data from a custom post type with ACF fields to a desktop application. The endpoint is working nicely except for one field when it has a blank value.
Specifically, the ‘HostSoftwareSupportedVersions’ field returns an array whenever one or more options are selected (what I need). Conversely, an empty string is returned whenever no options are selected. Although most items have a value, an empty value is acceptable in this case.
With that in mind, what I need is for WordPress to return an empty array, not string, if no option is selected. Below is the basic code I am working with. Again, the field I’m having trouble with is ‘HostSoftwareSupportedVersions’