WordPress.org

Make WordPress Core

Ticket #26825: 26825.2.diff

File 26825.2.diff, 1.1 KB (added by wonderboymusic, 6 years ago)
  • src/wp-admin/includes/media.php

     
    26162616        $att_url = wp_get_attachment_url( $post->ID ); ?>
    26172617        <div class="wp_attachment_holder">
    26182618        <?php
     2619        if ( $attachment_id && preg_match( '#^(audio|video)#', $post->post_mime_type ) ) {
     2620                $file = get_attached_file( $attachment_id );
     2621                $meta = wp_get_attachment_metadata( $attachment_id );
     2622                if ( empty( $meta ) && file_exists( $file ) ) {
     2623                        $_meta = get_post_meta( $attachment_id );
     2624                        $regeneration_lock = 'wp_regenerating_' . $attachment_id;
     2625                        if ( ! array_key_exists( '_wp_attachment_metadata', $_meta ) && ! get_transient( $regeneration_lock ) ) {
     2626                                set_transient( $regeneration_lock, $file );
     2627                                wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) );
     2628                                delete_transient( $regeneration_lock );
     2629                        }
     2630                }
     2631        }
     2632
    26192633        if ( wp_attachment_is_image( $post->ID ) ) :
    26202634                $image_edit_button = '';
    26212635                if ( wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) {