WordPress.org

Ready to get started?Download WordPress

Forums

wp_get_attachment_image not working with get_sub_field (ACF) (2 posts)

  1. Spencer Hill
    Member
    Posted 6 months ago #

    I'm using the Advanced Custom Fields Plugin function get_sub_field to pass the URL to wp_get_attachment_image but it's simply returning blank:

    <?php
    $url = get_sub_field( 'profile_picture' );
    echo wp_get_attachment_image( $url, 'full' );
    ?>

    PS I can't post in the ACF forums here because they're not monitored and I can't on the official website because something is wrong with my account so I can't sign in anyway. So please don't bother scolding me for not getting support there.

  2. Daniel Zimmermann
    Member
    Posted 5 months ago #

    This can't work because wp_get_attachment_image waits for an ID not an URL.

    But I am also looking for solution for this.

Reply

You must log in to post.

About this Topic