How to Change Image Attributes in WordPress Posts

WordPress default post showing the following result for image.

<img class="large alignnone size-full wp-image-8" src="http://localhost/blog/wp-content/uploads/2017/04/t-radio-city-music-hall.jpg" alt="" width="960" height="654" srcset="http://localhost/blog/wp-content/uploads/2017/04/t-radio-city-music-hall.jpg 960w, http://localhost/blog/wp-content/uploads/2017/04/t-radio-city-music-hall-300x204.jpg 300w, http://localhost/blog/wp-content/uploads/2017/04/t-radio-city-music-hall-768x523.jpg 768w" sizes="(max-width: 960px) 100vw, 960px">

How can I change these output as following?

  • Remove srcset
  • Replace src to data-original

Read more here: How to Change Image Attributes in WordPress Posts

Leave a Reply

Your email address will not be published. Required fields are marked *