Regenerate Thumbnails in WordPress

Basically for regenerating image in wordpress ,we use plugin.We think that it take lot of time and logic to make our own function for this purpose.

But it is not true.The magic is here in the following code.

You just need to pass the attachement id of the image.

For all the images you need to loop through all the images like this

This will regenerate all the existing image with the custom size you have defined.