WordPress.org

Make WordPress Core

Ticket #22596: 22596.diff

File 22596.diff, 1.4 KB (added by markoheijnen, 3 years ago)

Add wp_attachment_is_image() checks

  • wp-admin/includes/media.php

     
    11221122        $media_dims = apply_filters( 'media_meta', $media_dims, $post ); 
    11231123 
    11241124        $image_edit_button = ''; 
    1125         if ( wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) { 
     1125        if ( wp_attachment_is_image( $post->ID ) && wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) { 
    11261126                $nonce = wp_create_nonce( "image_editor-$post->ID" ); 
    11271127                $image_edit_button = "<input type='button' id='imgedit-open-btn-$post->ID' onclick='imageEdit.open( $post->ID, \"$nonce\" )' class='button' value='" . esc_attr__( 'Edit Image' ) . "' /> <span class='spinner'></span>"; 
    11281128        } 
     
    22532253        $att_url = wp_get_attachment_url( $post->ID ); 
    22542254 
    22552255        $image_edit_button = ''; 
    2256         if ( wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) { 
     2256        if ( wp_attachment_is_image( $post->ID ) && wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) { 
    22572257                $nonce = wp_create_nonce( "image_editor-$post->ID" ); 
    22582258                $image_edit_button = "<input type='button' id='imgedit-open-btn-$post->ID' onclick='imageEdit.open( $post->ID, \"$nonce\" )' class='button' value='" . esc_attr__( 'Edit Image' ) . "' /> <span class='spinner'></span>"; 
    22592259        }