How to Grab first image from wordpress post content

Posted in Web Development on 06.10.2015 by @chasebadkids

Sometimes you might find yourself in a situation where you have pages / posts that don’t have a featured image set but you want to pull an image to use on a listings page or some other page in your WordPress theme.

The following code will give you the ability to do just that.  It parses the content of the post and pulls in the first image that comes back.