I was seeing an infinite loop on my local Altis site.
The cause is actually several plugins, including at least Smart Media and Safe SVG, which hook into wp_get_attachment_metadata and either call get_attached_file() directly or call it indirectly via another function such as wp_attachment_is_image() which calls it. This causes an infinite loop when the filter attached to get_attached_file in this framework calls wp_get_attachment_metadata() again.
I did some investigation and none of the wp_get_attachment_metadata filters in use (on a default Altis site at least) are adjusting the value of the file property, so we can fix this by setting the $unfiltered parameter to true which avoids the wp_get_attachment_metadata filter.
I was seeing an infinite loop on my local Altis site.
The cause is actually several plugins, including at least Smart Media and Safe SVG, which hook into
wp_get_attachment_metadata
and either callget_attached_file()
directly or call it indirectly via another function such aswp_attachment_is_image()
which calls it. This causes an infinite loop when the filter attached toget_attached_file
in this framework callswp_get_attachment_metadata()
again.I did some investigation and none of the
wp_get_attachment_metadata
filters in use (on a default Altis site at least) are adjusting the value of thefile
property, so we can fix this by setting the$unfiltered
parameter to true which avoids thewp_get_attachment_metadata
filter.