WordPress.org

Ready to get started?Download WordPress

Forums

wp_get_attachment_image_src Array Not Working (4 posts)

  1. akabin
    Member
    Posted 3 years ago #

    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?

  2. akabin
    Member
    Posted 3 years ago #

    Still trying to figure this out. Any suggestions?

  3. _rg_
    Member
    Posted 3 years ago #

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

  4. akabin
    Member
    Posted 3 years ago #

    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]?

Topic Closed

This topic has been closed to new replies.

About this Topic