Returns a URL for a given attachment with the appropriate resizing querystring.

Typically, you should be using image sizes for handling this.

However, this function can come in handy if you want a specific artibitrary or varying image size.


Name Type Description
$attachment_id int ID of the attachment
$width int Width of our resized image
$height int Height of our resized image
$crop bool|array (optional) whether or not to crop the image for bool value. How to crop the image for array(x,y,w,h). The values of array can be either integers or numerical string trailing with "px". Eg.: array( 0, 0, '150px', '150px' ).

Return Value

string: URL of the resized attachmen

Ready to get started?

Tell us about your needs

Let us lead the way. We’ll help you select a top tier development partner. We’ll train your developers, operations, infrastructure, and editorial teams. We’ll coarchitect your deployment processes. We will provide live support for peak events. We’ll help your people avoid dark alleys and blind corners, and reduce wasted cycles.