mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Don't allow whitespace-only image captions from the Media modal.
Captions containing only whitespace trick `image_add_caption()` into thinking a caption is required, but the empty caption text confuses wpeditimage into stripping the 'align' class specified by the user. Fixes #21848. Built from https://develop.svn.wordpress.org/trunk@32079 git-svn-id: http://core.svn.wordpress.org/trunk@32058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0810c24ff0
commit
54a6a8e137
@ -2445,7 +2445,13 @@ function wp_ajax_send_attachment_to_editor() {
|
||||
$align = isset( $attachment['align'] ) ? $attachment['align'] : 'none';
|
||||
$size = isset( $attachment['image-size'] ) ? $attachment['image-size'] : 'medium';
|
||||
$alt = isset( $attachment['image_alt'] ) ? $attachment['image_alt'] : '';
|
||||
|
||||
// No whitespace-only captions.
|
||||
$caption = isset( $attachment['post_excerpt'] ) ? $attachment['post_excerpt'] : '';
|
||||
if ( '' === trim( $caption ) ) {
|
||||
$caption = '';
|
||||
}
|
||||
|
||||
$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 );
|
||||
} elseif ( wp_attachment_is( 'video', $post ) || wp_attachment_is( 'audio', $post ) ) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.2-beta4-32078';
|
||||
$wp_version = '4.2-beta4-32079';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user