Image code bloat

Hey guys,

Just wanted to ask if the code bloat on images on our site is caused by Sydney or by something else like Page Builder. Example:

As you can see there’s so much code around a single image, it’s pretty bad for load times when prevalent throughout the site.

Hello there,

That’s actually standard responsive image code since WordPress version 4.4. See the codex.

To disable it, add this snippet to your child theme’s functions.

    function sydney_child_disable_srcset( $sources ) {
        return false;
    }
    add_filter( 'wp_calculate_image_srcset', 'sydney_child_disable_srcset' );

If you don’t run any child themes, you could use a plugin that does same purpose like Code Snippets.

Regards,
Kharis

1 Like