hook add_attachment cannot complete its work


Good afternoon!

I need to clear everything fields when inserting an image in the WordPress loader.

On the Internet, I found a function:

    function my_set_image_meta_upon_image_upload( $  post_ID ) {        if ( wp_attachment_is_image( $  post_ID ) ) {          $  my_image_meta = array(           'ID'           => $  post_ID,           'post_title'   => '',           'post_excerpt' => '',           'post_content' => '',         );          update_post_meta( $  post_ID, '_wp_attachment_image_alt', '' );          wp_update_post( $  my_image_meta );       }     }     add_action( 'add_attachment', 'my_set_image_meta_upon_image_upload' ); 

It clears the fields but does not show the image (see the image):

image

How can this be fixed?

Thanks!