Support

Account

Home Forums General Issues Post object in Flexible Content Reply To: Post object in Flexible Content

  • This is getting your post object field

    
    $ctrlid = get_sub_field('agrement_du_centre'); 
    

    What is this field set to return?
    In any case this will not return anything because the value returned above is either an id or a post object.

    
    $post_object = get_field(' . $ctrlid . ');
    

    Taking a wild guess by looking at this since you named the value $ctrlid that you are returning the post ID then you would get fields from this other post by using

    
    get_field('field-name-on-other-post', $ctrlid);
    

    on the other hand if $ctrlid is a post object then you’d use

    
    get_field('field-name-on-other-post', $ctrlid->ID);