Skip to content

Refactor SVG loading and dimension handling#278

Merged
dkotter merged 1 commit into10up:developfrom
roborourke:patch-2
Aug 26, 2025
Merged

Refactor SVG loading and dimension handling#278
dkotter merged 1 commit into10up:developfrom
roborourke:patch-2

Conversation

@roborourke
Copy link
Copy Markdown
Contributor

@roborourke roborourke commented Aug 25, 2025

Description of the Change

Corrects the filters in the svg_dimensions method to return the documented value and data type, and additionally sends the attachment ID as the last parameter because it's more useful to do things with than the file path.

Closes #277

How to test the Change

The following snippet no longer throws a fatal error.

add_filter( 'safe_svg_use_width_height_attributes', function ( bool $use_width_height, string $svg ) {
	return $use_width_height;
}, 10, 2 );

Changelog Entry

Changed - Added $attachment_id argument to filters safe_svg_use_width_height_attributes and safe_svg_dimensions.
Fixed - Inconsistent or incorrect data type for $svg argument in the filters safe_svg_use_width_height_attributes and safe_svg_dimensions.

Credits

Props @roborourke

Checklist:

@dkotter dkotter added this to the 2.4.0 milestone Aug 26, 2025
@dkotter dkotter merged commit a8294c7 into 10up:develop Aug 26, 2025
13 checks passed
@roborourke roborourke deleted the patch-2 branch August 27, 2025 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants