[wp-trac] [WordPress Trac] #39108: Media: can't leave an image "untitled" from the "Edit Media" menu

WordPress Trac noreply at wordpress.org
Wed Apr 13 20:46:53 UTC 2022


#39108: Media: can't leave an image "untitled" from the "Edit Media" menu
-------------------------------------------------+-------------------------
 Reporter:  dromero20                            |       Owner:  audrasjb
     Type:  defect (bug)                         |      Status:  reviewing
 Priority:  normal                               |   Milestone:  6.0
Component:  Media                                |     Version:  4.6.1
 Severity:  normal                               |  Resolution:
 Keywords:  good-first-bug has-patch has-        |     Focuses:
  testing-info assigned-for-commit needs-dev-    |
  note                                           |
-------------------------------------------------+-------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:23 audrasjb]:
 > Instead of completely remove this filter, shouldn't we deprecate it?
 >
 > Looks like at least 64 plugins are using it:
 https://wpdirectory.net/search/01FZJMWDNYAJPXRGH546GQ8C24

 It looks like most of those are either false positives or copies of the
 original function, though removing the function would indeed cause
 backward compatibility concerns. If it's no longer relevant, it should be
 deprecated instead.

 I was also curious whether new attachments would still get their title on
 upload if this filter is removed. Upon some testing,
 `media_handle_upload()` still assigns the initial title as expected.

 Some history here:
 * `media_handle_upload()` was introduced in [6659].
 * `image_attachment_fields_to_save()` was introduced in [6876] / #5874.

 To summarize, removing this line is enough to fix the issue and achieve
 the desired result of using the `(no title)` fallback, as mentioned in
 comment:11:
 {{{
 add_filter( 'attachment_fields_to_save',
 'image_attachment_fields_to_save', 10, 2 );
 }}}

 Whether the function itself should be deprecated can be up for discussion.
 If it's not used anywhere else in core, I think it makes sense to
 deprecate it.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/39108#comment:25>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list