[Support request] Elements header breaks ACF return values

Home Forums Support Elements header breaks ACF return values

  • This topic has 15 replies, 3 voices, and was last updated 8 months ago by Tom.
Viewing 16 post (of 16 total)
  • Author
    Posts
  • #1405211
    Tom
    Lead Developer
    Lead Developer

    The {{custom_field}} template tag is set to return single values. If the custom field you’re using is returning an array, it won’t work.

    You could try this to debug:

    add_shortcode( 'embed_file', function() {
        ob_start();
        $current_post = get_queried_object();
        
        $embed_file = get_field( 'report_file', $current_post );
        var_dump($embed_file);
        $report_file_url = $embed_file['url'];
    
        echo $report_file_url;
        return ob_get_clean();
    } );
Viewing 16 post (of 16 total)
  • You must be logged in to reply to this topic.