[wp-trac] [WordPress Trac] #52030: Media metaboxes return fatal error if no author metadata present

WordPress Trac noreply at wordpress.org
Fri Dec 11 17:48:37 UTC 2020


#52030: Media metaboxes return fatal error if no author metadata present
---------------------------------+---------------------
 Reporter:  carloscastilloadhoc  |       Owner:  (none)
     Type:  defect (bug)         |      Status:  new
 Priority:  normal               |   Milestone:  5.6.1
Component:  Media                |     Version:  5.6
 Severity:  normal               |  Resolution:
 Keywords:                       |     Focuses:
---------------------------------+---------------------

Comment (by SergeyBiryukov):

 As noted above, the code in `attachment_submitbox_metadata()` uses
 `get_userdata()`:
 {{{
 $author = get_userdata( $post->post_author );
 }}}
 which indeed returns `false` on failure.

 However, the similar code in `wp_prepare_attachment_for_js()` creates a
 new instance of `WP_User` instead:
 {{{
 $author = new WP_User( $attachment->post_author );
 }}}

 Would be great to have some consistency here.

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


More information about the wp-trac mailing list