How to Grab first image from wordpress post content

Published: 23, Oct 2014
PHPWordPress

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.

 

 

Phone

(714) 501-9867

Address

Orange County, California