Media: In wp_ajax_send_attachment_to_editor()
, the fallback logic for $html
should be tucked into an else
statement so it isn't run needlessly and overwritten.
Props tychay. Fixes #32072. git-svn-id: https://develop.svn.wordpress.org/trunk@34260 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
337c87e7c7
commit
189bc9b5aa
@ -2491,13 +2491,10 @@ function wp_ajax_send_attachment_to_editor() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$rel = $url = '';
|
$rel = '';
|
||||||
$html = isset( $attachment['post_title'] ) ? $attachment['post_title'] : '';
|
$url = empty( $attachment['url'] ) ? '' : $attachment['url'];
|
||||||
if ( ! empty( $attachment['url'] ) ) {
|
if ( strpos( $url, 'attachment_id') || get_attachment_link( $id ) == $url ) {
|
||||||
$url = $attachment['url'];
|
$rel = ' rel="attachment wp-att-' . $id . '"';
|
||||||
if ( strpos( $url, 'attachment_id') || get_attachment_link( $id ) == $url )
|
|
||||||
$rel = ' rel="attachment wp-att-' . $id . '"';
|
|
||||||
$html = '<a href="' . esc_url( $url ) . '"' . $rel . '>' . $html . '</a>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_filter( 'media_send_to_editor', 'image_media_send_to_editor' );
|
remove_filter( 'media_send_to_editor', 'image_media_send_to_editor' );
|
||||||
@ -2514,9 +2511,14 @@ function wp_ajax_send_attachment_to_editor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$title = ''; // We no longer insert title tags into <img> tags, as they are redundant.
|
$title = ''; // We no longer insert title tags into <img> tags, as they are redundant.
|
||||||
$html = get_image_send_to_editor( $id, $caption, $title, $align, $url, (bool) $rel, $size, $alt );
|
$html = get_image_send_to_editor( $id, $caption, $title, $align, $url, $rel, $size, $alt );
|
||||||
} elseif ( wp_attachment_is( 'video', $post ) || wp_attachment_is( 'audio', $post ) ) {
|
} elseif ( wp_attachment_is( 'video', $post ) || wp_attachment_is( 'audio', $post ) ) {
|
||||||
$html = stripslashes_deep( $_POST['html'] );
|
$html = stripslashes_deep( $_POST['html'] );
|
||||||
|
} else {
|
||||||
|
$html = isset( $attachment['post_title'] ) ? $attachment['post_title'] : '';
|
||||||
|
if ( ! empty( $url ) ) {
|
||||||
|
$html = '<a href="' . esc_url( $url ) . '"' . $rel . '>' . $html . '</a>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This filter is documented in wp-admin/includes/media.php */
|
/** This filter is documented in wp-admin/includes/media.php */
|
||||||
|
Loading…
Reference in New Issue
Block a user