Description
Image and File fields always return numeric IDs in the REST API regardless of the return_format field setting (array, url, or id).
Steps to Reproduce
- Create an Image field with
return_format set to "URL" or "Array"
- Attach an image to a post
- Fetch the post via REST API
- Observe that the field returns only the numeric attachment ID
Expected Behavior
The REST API should respect the return_format setting.
Root Cause
In includes/fields/class-acf-field-image.php, the format_value_for_rest() method ignores the field's return_format setting. Same issue in class-acf-field-file.php.
Related