Support » Fixing WordPress » wp_get_attachment_image_src Array Not Working

  • In the Function Reference for wp_get_attachment_image_src it says you can use an array to pull a specific size of a thumbnail. I’ve tried everything I can think of but can’t get it to pull the size specified by the array. Here is my code:

    $src = wp_get_attachment_image_src( get_post_thumbnail_id( $id ), array(160,90) );

    It defaults to the thumbnail I’m assuming since the array isn’t recognized. Suggestions?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Still trying to figure this out. Any suggestions?

    try with wp_get_attachment_image(), i know, it will not give you the src, but the entire img tag…. but works.

    Unfortunately it’s going in the meta data, so I need it without the img tag. That then puts the image at the top of my WordPress page. I’m just really curious why the array isn’t working actually. That’s the correct format for an array in .php right? Or is it array[160,90]?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘wp_get_attachment_image_src Array Not Working’ is closed to new replies.