From 41c678695289110751e6aeebe15e9261a1d4f712 Mon Sep 17 00:00:00 2001 From: Felix Arntz Date: Tue, 22 Jun 2021 21:22:27 +0000 Subject: [PATCH] Media: Add lazy-loading support to block-based widgets. This changeset adds the `wp_filter_content_tags()` function as a filter to `widget_block_content`. Props spacedmonkey, walbo, daisyo. Fixes #53463, #53464. git-svn-id: https://develop.svn.wordpress.org/trunk@51207 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/default-filters.php | 1 + tests/phpunit/tests/media.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/wp-includes/default-filters.php b/src/wp-includes/default-filters.php index ba241dbcb4..144ddc8ccd 100644 --- a/src/wp-includes/default-filters.php +++ b/src/wp-includes/default-filters.php @@ -215,6 +215,7 @@ add_filter( 'widget_text_content', 'wp_replace_insecure_home_url' ); add_filter( 'widget_text_content', 'do_shortcode', 11 ); // Runs after wpautop(); note that $post global will be null when shortcodes run. add_filter( 'widget_block_content', 'do_blocks', 9 ); +add_filter( 'widget_block_content', 'wp_filter_content_tags' ); add_filter( 'widget_block_content', 'do_shortcode', 11 ); add_filter( 'block_type_metadata', 'wp_migrate_old_typography_shape' ); diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php index 9a28743f5e..342e035536 100644 --- a/tests/phpunit/tests/media.php +++ b/tests/phpunit/tests/media.php @@ -3022,6 +3022,7 @@ EOF; /** * @ticket 50425 + * @ticket 53463 * @dataProvider data_wp_lazy_loading_enabled_context_defaults * * @param string $context Function context. @@ -3041,6 +3042,7 @@ EOF; 'the_content => true' => array( 'the_content', true ), 'the_excerpt => true' => array( 'the_excerpt', true ), 'widget_text_content => true' => array( 'widget_text_content', true ), + 'widget_block_content => true' => array( 'widget_block_content', true ), 'get_avatar => true' => array( 'get_avatar', true ), 'arbitrary context => true' => array( 'something_completely_arbitrary', true ), );