Support

Account

Home Forums Backend Issues (wp-admin) ACF image shortcode not working

Solved

ACF image shortcode not working

  • Hi
    i want display my image filed in page i am using shortcode but its won’s show

    I am using this short code in my page

    <img src="[acf field='interview_first_image']" />

  • Hi @suresh

    Can you confirm that the image field return type has been set to URL in your field settings?

    The code should also be within the posts loop and if not, you should assign a post id parameter like so:

    <img src="[acf field='interview_first_image' post_id='123']" />

  • HI James,

    Thank you so much its working fine. i want dynamically post id how can i set that one also.

  • Hi @suresh

    You could store the post ids in a dynamic variable and then echo the shortcode depending on the post id stored like so:

    //some logic to get the post id
    $post_id = $value;
    
    <img src="[acf field='interview_first_image' post_id="'. $post_id .'"]" />
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.