Only show the image edit button for image attachments. Props markoheijnen. fixes #22596
git-svn-id: http://core.svn.wordpress.org/trunk@22867 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
adae728f00
commit
11c5f2c1fc
|
@ -1132,7 +1132,7 @@ function get_media_item( $attachment_id, $args = null ) {
|
||||||
$media_dims = apply_filters( 'media_meta', $media_dims, $post );
|
$media_dims = apply_filters( 'media_meta', $media_dims, $post );
|
||||||
|
|
||||||
$image_edit_button = '';
|
$image_edit_button = '';
|
||||||
if ( wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) {
|
if ( wp_attachment_is_image( $post->ID ) && wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) {
|
||||||
$nonce = wp_create_nonce( "image_editor-$post->ID" );
|
$nonce = wp_create_nonce( "image_editor-$post->ID" );
|
||||||
$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>";
|
$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>";
|
||||||
}
|
}
|
||||||
|
@ -2270,7 +2270,7 @@ function edit_form_image_editor() {
|
||||||
$att_url = wp_get_attachment_url( $post->ID );
|
$att_url = wp_get_attachment_url( $post->ID );
|
||||||
|
|
||||||
$image_edit_button = '';
|
$image_edit_button = '';
|
||||||
if ( wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) {
|
if ( wp_attachment_is_image( $post->ID ) && wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) {
|
||||||
$nonce = wp_create_nonce( "image_editor-$post->ID" );
|
$nonce = wp_create_nonce( "image_editor-$post->ID" );
|
||||||
$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>";
|
$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>";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue