Remove srcset on WordPress

Since version 4.4, WordPress has a native responsive image support by including srcset and sizes attributes to the image markups. It's a good function, no doubts.

However, it can cause problems which you are probably have, if you are reading this.

In my case, I convert my blog from a local WordPress installation using HTTrack. As for today, HTTrack can't recognize those attributes, then, some images weren't being showing for my readers.

Solution

    1. Install the plugin Code Snippets;
    2. Add a new snippet with the following code:
      add_filter( 'wp_calculate_image_srcset_meta', '__return_null' );
    3. Press the "Save changes and Active" button. You are good to go.

Code by birgire

Comments