diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index 8965da9ac2..614497a46b 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -1603,7 +1603,7 @@ function img_caption_shortcode( $attr, $content = null ) { $style = ''; if ( $caption_width ) { - $style = 'style="max-width: ' . (int) $caption_width . 'px" '; + $style = 'style="width: ' . (int) $caption_width . 'px" '; } if ( $html5 ) { diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php index e55a4cea97..f2961b8355 100644 --- a/tests/phpunit/tests/media.php +++ b/tests/phpunit/tests/media.php @@ -132,9 +132,9 @@ CAP; $this->assertEquals( 1, preg_match_all( "/{$this->caption}/", $result, $_r ) ); if ( current_theme_supports( 'html5', 'caption' ) ) { - $this->assertEquals( 1, preg_match_all( '/max-width: 20/', $result, $_r ) ); + $this->assertEquals( 1, preg_match_all( '/width: 20/', $result, $_r ) ); } else { - $this->assertEquals( 1, preg_match_all( '/max-width: 30/', $result, $_r ) ); + $this->assertEquals( 1, preg_match_all( '/width: 30/', $result, $_r ) ); } } diff --git a/tests/phpunit/tests/shortcode.php b/tests/phpunit/tests/shortcode.php index 5acd7e268f..3577fab338 100644 --- a/tests/phpunit/tests/shortcode.php +++ b/tests/phpunit/tests/shortcode.php @@ -535,7 +535,7 @@ EOF; ), array( '[caption caption="test" width="2"]
hello
[/caption]', - '
hello

test

', + '
hello

test

', ), array( '
',