The team at WPBeginner have assembled a post explaining how to use and manipulate WordPress image sizes. It’s important to understand this, particularly after the TimThumb security issue last month.
The team at WPBeginner have assembled a post explaining how to use and manipulate WordPress image sizes. It’s important to understand this, particularly after the TimThumb security issue last month.
Good article but it doesn’t mention the
set_post_thumbnail_size()function which you can use to set the default WordPress image size.This default size can then be retrieved with just:
There is also a useful function to test for the existence of a post thumbnail before you try and use it:
if ( has_post_thumbnail() ) {
the_post_thumbnail(); // use default theme thumbnail size
}
(missing code from above)
This default size can then be retrieved with just:
the_post_thumbnail();