Skip to content

[Bug]: get_attached_file not returning global media path #147

Description

@dave-green-uk

Description of the bug

The core get_attached_file function is returning false when trying to retrieve an image that is in the global media library.

Reproduction instructions

  1. Attempt to get the path to the image using get_attached_file( $image_id )

Expected behavior

Receive an image path in the response to get_attached_file( $image_id ).

Environment info

Standard WordPress multisite setup

Relevant log output

No response

Additional context

A customer has raised a compatibility issue with one of our products, and we're looking for insight into how we can patch this.

Naturally, the switch_to_blog approach isn't working as there is more going on here. Any advice welcome!

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions