Introduced in [22783] and [23094].
In 3.4, attachment_fields_to_save
filter was only called in media_upload_form_handler()
for a post array received from get_post()
, which contained a guid
field: tags/3.6/wp-admin/includes/media.php#517.
Since 3.5, it's also called in edit_post()
for an array that contains an attachment_url
field instead: tags/3.6/wp-admin/includes/post.php#L264.
I'd suggest checking both fields, as long as we still have both scenarios in core. Although the former one is no longer used in the new media UI, there's a plugin that re-enables the old UI.
We should also replace basename()
with wp_basename()
, as in [22367] and [24585]. See 25236.patch.