diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index 1a20c919d2..adba75fcd7 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -195,16 +195,17 @@ add_filter( 'the_content', 'convert_smilies', 20 ); add_filter( 'the_content', 'wpautop' ); add_filter( 'the_content', 'shortcode_unautop' ); add_filter( 'the_content', 'prepend_attachment' ); -add_filter( 'the_content', 'wp_filter_content_tags' ); add_filter( 'the_content', 'wp_replace_insecure_home_url' ); +add_filter( 'the_content', 'do_shortcode', 11 ); // AFTER wpautop(). +add_filter( 'the_content', 'wp_filter_content_tags', 12 ); // Runs after do_shortcode(). add_filter( 'the_excerpt', 'wptexturize' ); add_filter( 'the_excerpt', 'convert_smilies' ); add_filter( 'the_excerpt', 'convert_chars' ); add_filter( 'the_excerpt', 'wpautop' ); add_filter( 'the_excerpt', 'shortcode_unautop' ); -add_filter( 'the_excerpt', 'wp_filter_content_tags' ); add_filter( 'the_excerpt', 'wp_replace_insecure_home_url' ); +add_filter( 'the_excerpt', 'wp_filter_content_tags', 12 ); add_filter( 'get_the_excerpt', 'wp_trim_excerpt', 10, 2 ); add_filter( 'the_post_thumbnail_caption', 'wptexturize' ); @@ -230,13 +231,13 @@ add_filter( 'widget_text_content', 'wptexturize' ); add_filter( 'widget_text_content', 'convert_smilies', 20 ); add_filter( 'widget_text_content', 'wpautop' ); add_filter( 'widget_text_content', 'shortcode_unautop' ); -add_filter( 'widget_text_content', 'wp_filter_content_tags' ); 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_text_content', 'wp_filter_content_tags', 12 ); // Runs after do_shortcode(). 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( 'widget_block_content', 'wp_filter_content_tags', 12 ); // Runs after do_shortcode(). add_filter( 'block_type_metadata', 'wp_migrate_old_typography_shape' ); @@ -625,9 +626,6 @@ add_action( 'change_locale', 'create_initial_taxonomies' ); add_action( 'template_redirect', 'redirect_canonical' ); add_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 ); -// Shortcodes. -add_filter( 'the_content', 'do_shortcode', 11 ); // AFTER wpautop(). - // Media. add_action( 'wp_playlist_scripts', 'wp_playlist_scripts' ); add_action( 'customize_controls_enqueue_scripts', 'wp_plupload_default_settings' ); diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 76f77c2a90..f94d3170a5 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -3980,7 +3980,7 @@ function wp_trim_excerpt( $text = '', $post = null ) { * within the excerpt are stripped out. Modifying the tags here * is wasteful and can lead to bugs in the image counting logic. */ - $filter_image_removed = remove_filter( 'the_content', 'wp_filter_content_tags' ); + $filter_image_removed = remove_filter( 'the_content', 'wp_filter_content_tags', 12 ); /* * Temporarily unhook do_blocks() since excerpt_remove_blocks( $text ) @@ -4003,7 +4003,7 @@ function wp_trim_excerpt( $text = '', $post = null ) { * which is generally used for the filter callback in WordPress core. */ if ( $filter_image_removed ) { - add_filter( 'the_content', 'wp_filter_content_tags' ); + add_filter( 'the_content', 'wp_filter_content_tags', 12 ); } /* translators: Maximum number of words used in a post excerpt. */ diff --git a/wp-includes/media.php b/wp-includes/media.php index 13fa8e9930..988086e009 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -5649,16 +5649,20 @@ function wp_get_loading_optimization_attributes( $tag_name, $attr, $context ) { } /* - * Skip programmatically created images within post content as they need to be handled together with the other - * images within the post content. + * Skip programmatically created images within content blobs as they need to be handled together with the other + * images within the post content or widget content. * Without this clause, they would already be considered within their own context which skews the image count and * can result in the first post content image being lazy-loaded or an image further down the page being marked as a * high priority. */ - // TODO: Handle shortcode images together with the content (see https://core.trac.wordpress.org/ticket/58853). - if ( 'the_content' !== $context && 'do_shortcode' !== $context && doing_filter( 'the_content' ) ) { + if ( + 'the_content' !== $context && doing_filter( 'the_content' ) || + 'widget_text_content' !== $context && doing_filter( 'widget_text_content' ) || + 'widget_block_content' !== $context && doing_filter( 'widget_block_content' ) + ) { /** This filter is documented in wp-includes/media.php */ return apply_filters( 'wp_get_loading_optimization_attributes', $loading_attrs, $tag_name, $attr, $context ); + } /* diff --git a/wp-includes/version.php b/wp-includes/version.php index 9cf213f3c6..f461397d37 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.4-alpha-56692'; +$wp_version = '6.4-alpha-56693'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.