Skip to content

Image and File fields ignore return_format setting in REST API #277

@priethor

Description

@priethor

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

  1. Create an Image field with return_format set to "URL" or "Array"
  2. Attach an image to a post
  3. Fetch the post via REST API
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Type] BugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions