-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for ACF image field return format #32
Comments
Same problem, i think that this is an important tasks, it doesn't support any image return format. |
Hello @raidoa Did you get any solutions for image I am also struggling with the things. Please let me know If you have found any solutions. |
I am not an expert on Wordpress, PHP, ACF or Gutenberg, but I ran into this problem and was able to add support for this to the library. I added an
This causes the api to return something like:
instead of The big caveat here is that as far as I could find, there was no obvious way to tell the intended type of an ACF field, so I can't tell the difference between something intended to be an integer and something intended to be a picture. Thus, I try to make an integer into an image object only if the variable name doesn't start with an underscore and it has "image" in the variable name. Obviously, that is not a foolproof system, but it was the best thing I could come up with, and works well enough to make the system usable. If anyone does know how to tell the intended datatype of an ACF field, please let us know because that would be much less prone to user error. I've attached my version of data.php for reference. |
Hi!
When creating an image field with ACF, wp-rest-blocks does not seem to respect the chosen return format in the ACF field settings.
When I choose "Image URL" or "Image Array", it still returns Image ID in the API.
Chosen settings for the field:

Output in the API:

Not even sure if wp-rest-blocks should respect those settings or is it the responsibility of the ACF plugin instead?
The text was updated successfully, but these errors were encountered: