1 March 2015

Get the thumbnail src for a specific thumbnail size in WordPress

I use this a lot in themes, but always find myself having to look it up.

No longer. Here it is:

And for the img element:

This assumes you are in the loop. If you are not, you’ll need to retrieve the correct ID with a function such as get_page_by_title() in place of get_the_ID().