Skip to content

Commit dab5c87

Browse files
committed
Add global in DOC comment, Remove unnecessary is_array check, Update comment about usage of global
1 parent bd0d865 commit dab5c87

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

plugins/webp-uploads/hooks.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,8 @@ function webp_uploads_init(): void {
785785
* Automatically opt into extra image sizes when generating fallback images.
786786
*
787787
* @since n.e.x.t
788+
*
789+
* @global array $_wp_additional_image_sizes Associative array of additional image sizes.
788790
*/
789791
function webp_uploads_opt_in_extra_image_sizes(): void {
790792
if ( ! webp_uploads_is_fallback_enabled() ) {
@@ -793,11 +795,7 @@ function webp_uploads_opt_in_extra_image_sizes(): void {
793795

794796
global $_wp_additional_image_sizes;
795797

796-
if ( ! is_array( $_wp_additional_image_sizes ) ) {
797-
return;
798-
}
799-
800-
// NOTE: Modifying global to mimic the "hypothetical" WP core API behavior.
798+
// Modify global to mimic the "hypothetical" WP core API behavior via an additional `add_image_size()` parameter.
801799

802800
if ( isset( $_wp_additional_image_sizes['1536x1536'] ) && ! isset( $_wp_additional_image_sizes['1536x1536']['provide_additional_mime_types'] ) ) {
803801
$_wp_additional_image_sizes['1536x1536']['provide_additional_mime_types'] = true; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited

0 commit comments

Comments
 (0)