Widgets: Prevent showing underlying attachment excerpt as caption when empty caption value is supplied in Image widget.
Allow underlying attachment to display if `caption` is `null`. Props miyauchi, westonruter. See #39993. Fixes #42350. Built from https://develop.svn.wordpress.org/trunk@42030 git-svn-id: http://core.svn.wordpress.org/trunk@41864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -177,8 +177,10 @@ class WP_Widget_Media_Image extends WP_Widget_Media {
|
||||
$attachment = get_post( $instance['attachment_id'] );
|
||||
}
|
||||
if ( $attachment ) {
|
||||
$caption = $attachment->post_excerpt;
|
||||
if ( $instance['caption'] ) {
|
||||
$caption = '';
|
||||
if ( ! isset( $instance['caption'] ) ) {
|
||||
$caption = $attachment->post_excerpt;
|
||||
} elseif ( trim( $instance['caption'] ) ) {
|
||||
$caption = $instance['caption'];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user