diff --git a/src/wp-includes/class-wp-embed.php b/src/wp-includes/class-wp-embed.php
index aff25412c3..4b189f9334 100644
|
a
|
b
|
class WP_Embed {
|
| 31 | 31 | // Hack to get the [embed] shortcode to run before wpautop(). |
| 32 | 32 | add_filter( 'the_content', array( $this, 'run_shortcode' ), 8 ); |
| 33 | 33 | add_filter( 'widget_text_content', array( $this, 'run_shortcode' ), 8 ); |
| | 34 | add_filter( 'widget_block_content', array( $this, 'run_shortcode' ), 8 ); |
| 34 | 35 | |
| 35 | 36 | // Shortcode placeholder for strip_shortcodes(). |
| 36 | 37 | add_shortcode( 'embed', '__return_false' ); |
| … |
… |
class WP_Embed {
|
| 38 | 39 | // Attempts to embed all URLs in a post. |
| 39 | 40 | add_filter( 'the_content', array( $this, 'autoembed' ), 8 ); |
| 40 | 41 | add_filter( 'widget_text_content', array( $this, 'autoembed' ), 8 ); |
| | 42 | add_filter( 'widget_block_content', array( $this, 'autoembed' ), 8 ); |
| 41 | 43 | |
| 42 | 44 | // After a post is saved, cache oEmbed items via Ajax. |
| 43 | 45 | add_action( 'edit_form_advanced', array( $this, 'maybe_run_ajax_cache' ) ); |
diff --git a/src/wp-includes/default-filters.php b/src/wp-includes/default-filters.php
index d2a89ed4d1..8663196248 100644
|
a
|
b
|
add_filter( 'widget_text_content', 'wp_filter_content_tags' );
|
| 214 | 214 | add_filter( 'widget_text_content', 'wp_replace_insecure_home_url' ); |
| 215 | 215 | add_filter( 'widget_text_content', 'do_shortcode', 11 ); // Runs after wpautop(); note that $post global will be null when shortcodes run. |
| 216 | 216 | |
| | 217 | add_filter( 'widget_block_content', 'do_blocks', 9 ); |
| | 218 | add_filter( 'widget_block_content', 'do_shortcode', 11 ); |
| | 219 | |
| 217 | 220 | add_filter( 'wp_get_custom_css', 'wp_replace_insecure_home_url' ); |
| 218 | 221 | |
| 219 | 222 | // RSS filters. |
diff --git a/src/wp-includes/widgets/class-wp-widget-block.php b/src/wp-includes/widgets/class-wp-widget-block.php
index 4c5abb38a4..b191bfaf31 100644
|
a
|
b
|
class WP_Widget_Block extends WP_Widget {
|
| 66 | 66 | $args['before_widget'] |
| 67 | 67 | ); |
| 68 | 68 | |
| 69 | | // Handle embeds for block widgets. |
| 70 | | // |
| 71 | | // When this feature is added to core it may need to be implemented |
| 72 | | // differently. WP_Widget_Text is a good reference, that applies a |
| 73 | | // filter for its content, which WP_Embed uses in its constructor. |
| 74 | | // See https://core.trac.wordpress.org/ticket/51566. |
| 75 | | global $wp_embed; |
| 76 | | $content = $wp_embed->run_shortcode( $instance['content'] ); |
| 77 | | $content = $wp_embed->autoembed( $content ); |
| 78 | | |
| 79 | | $content = do_blocks( $content ); |
| 80 | | $content = do_shortcode( $content ); |
| 81 | | |
| 82 | | echo $content; |
| | 69 | /** |
| | 70 | * Filters the content of the Block widget before output. |
| | 71 | * |
| | 72 | * @since 5.8.0 |
| | 73 | * |
| | 74 | * @param string $content The widget content. |
| | 75 | * @param array $instance Array of settings for the current widget. |
| | 76 | * @param WP_Widget_Text $widget Current Block widget instance. |
| | 77 | */ |
| | 78 | echo apply_filters( |
| | 79 | 'widget_block_content', |
| | 80 | $instance['content'], |
| | 81 | $instance, |
| | 82 | $this |
| | 83 | ); |
| 83 | 84 | |
| 84 | 85 | echo $args['after_widget']; |
| 85 | 86 | } |