• Resolved Ulrich

    (@grapplerulrich)


    When regenerating images the SVG files do not get excluded thus causing an error which is not clear why.

    $ wp media regenerate 232
    Found 1 image to regenerate.
    Warning: 1/1 Couldn't regenerate thumbnails for "stylelint" (ID 232).
    Error: No images regenerated.

    By adding a bit of extra code it can be made clear why a certain file is not being processed.

    add_filter( 'wp_generate_attachment_metadata', function( $metadata, $attachment_id ) {
    	if ( 'image/svg+xml' === get_post_mime_type( $attachment_id ) ) {
    		return new WP_Error( 'skip_svg_generate', __( 'Skipping SVG files.', 'textdomain' ) );
    	}
    	return $metadata;
    }, 10, 2 );

    When running the regenerate script the information would be clearer.

    $ wp media regenerate 232
    Found 1 image to regenerate.
    Warning: Skipping SVG files.
    Error: No images regenerated.
Viewing 1 replies (of 1 total)
  • Plugin Contributor Daryll Doyle

    (@enshrined)

    Hi @grapplerulrich,

    Thanks for that, it’s something that had completely slipped my mind.

    I’m planning on testing the plugin with 4.9 later today so will get this put in at the same time!

    Cheers,
    Daryll

Viewing 1 replies (of 1 total)

The topic ‘Skipping SVG when regenerating images’ is closed to new replies.