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?

Drop us a note.

No matter where you are in the planning process, we’re happy to help, and we’re actual humans here on the other side of the form. 👋 We’re here to discuss your challenges and plans, evaluate your existing resources or a potential partner, or even make some initial recommendations. And, of course, we’re here to help any time you’re in the market for some robust WordPress awesomeness.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.