diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index f88398d0ee..fc0f4408f7 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -519,6 +519,7 @@ 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' ); +add_action( 'plugins_loaded', '_wp_add_additional_image_sizes', 0 ); // Nav menu add_filter( 'nav_menu_item_id', '_nav_menu_item_id_use_once', 10, 2 ); diff --git a/wp-includes/media.php b/wp-includes/media.php index b9601c3f60..6f104a20c7 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -1200,10 +1200,10 @@ function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attac * * @since 4.4.0 * - * @param int $max_width The maximum image width to be included in the 'srcset'. Default '1600'. + * @param int $max_width The maximum image width to be included in the 'srcset'. Default '2048'. * @param array $size_array Array of width and height values in pixels (in that order). */ - $max_srcset_image_width = apply_filters( 'max_srcset_image_width', 1600, $size_array ); + $max_srcset_image_width = apply_filters( 'max_srcset_image_width', 2048, $size_array ); // Array to hold URL candidates. $sources = array(); @@ -4329,3 +4329,23 @@ function wp_media_personal_data_exporter( $email_address, $page = 1 ) { 'done' => $done, ); } + +/** + * Add additional default image sub-sizes. + * + * These sizes are meant to enhance the way WordPress displays images on the front-end on larger, + * high-density devices. They make it possible to generate more suitable `srcset` and `sizes` attributes + * when the users upload large images. + * + * The sizes can be changed or removed by themes and plugins but that is not recommended. + * The size "names" reflect the image dimensions, so changing the sizes would be quite misleading. + * + * @since 5.3.0 + * @access private + */ +function _wp_add_additional_image_sizes() { + // 2x medium_large size + add_image_size( '1536x1536', 1536, 1536 ); + // 2x large size + add_image_size( '2048x2048', 2048, 2048 ); +} diff --git a/wp-includes/version.php b/wp-includes/version.php index 66f9285da3..c93461675c 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-alpha-46028'; +$wp_version = '5.3-alpha-46066'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.