diff --git src/wp-includes/widgets/class-wp-widget-custom-html.php src/wp-includes/widgets/class-wp-widget-custom-html.php
index 2db50f4d22..349e39fcae 100644
|
|
class WP_Widget_Custom_HTML extends WP_Widget { |
63 | 63 | |
64 | 64 | $content = $instance['content']; |
65 | 65 | |
| 66 | // Just-in-time add shortcode handling if a plugin added it for the Text widget. |
| 67 | $add_text_widget_shortcode_handling = ( |
| 68 | false !== has_filter( 'widget_text', 'do_shortcode' ) |
| 69 | && |
| 70 | false === has_filter( 'widget_custom_html_content', 'do_shortcode' ) |
| 71 | ); |
| 72 | if ( $add_text_widget_shortcode_handling ) { |
| 73 | add_filter( 'widget_custom_html_content', 'do_shortcode', 10, 2 ); |
| 74 | } |
| 75 | |
66 | 76 | /** |
67 | 77 | * Filters the content of the Custom HTML widget. |
68 | 78 | * |
… |
… |
class WP_Widget_Custom_HTML extends WP_Widget { |
74 | 84 | */ |
75 | 85 | $content = apply_filters( 'widget_custom_html_content', $content, $instance, $this ); |
76 | 86 | |
| 87 | if ( $add_text_widget_shortcode_handling ) { |
| 88 | remove_filter( 'widget_custom_html_content', 'do_shortcode' ); |
| 89 | } |
| 90 | |
77 | 91 | echo $args['before_widget']; |
78 | 92 | if ( ! empty( $title ) ) { |
79 | 93 | echo $args['before_title'] . $title . $args['after_title']; |