diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php index 11629ae6e9..5f7b481044 100644 --- a/src/wp-admin/includes/media.php +++ b/src/wp-admin/includes/media.php @@ -3288,10 +3288,11 @@ function attachment_submitbox_metadata() { $att_url = wp_get_attachment_url( $attachment_id ); - $author = get_userdata( $post->post_author ); + $author = new WP_User( $post->post_author ); $uploaded_by_name = __( '(no author)' ); $uploaded_by_link = ''; + if ( $author->exists() ) { $uploaded_by_name = $author->display_name ? $author->display_name : $author->nickname; $uploaded_by_link = get_edit_user_link( $author->ID ); diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index e651dcbccf..667d649a2a 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -3861,6 +3861,7 @@ function wp_prepare_attachment_for_js( $attachment ) { ); $author = new WP_User( $attachment->post_author ); + if ( $author->exists() ) { $author_name = $author->display_name ? $author->display_name : $author->nickname; $response['authorName'] = html_entity_decode( $author_name, ENT_QUOTES, get_bloginfo( 'charset' ) );