Support

Account

Home Forums General Issues get_field(); returns blank value Reply To: get_field(); returns blank value

  • That is because, by the looks of things, you’re calling the function outside of the loop and ACF does not know what post to get the values from… that is unless you’re not including enough code form me to tell.

    Are you’re function calls inside “the loop” or outside.

    If you’re outside the loop then you can try something like this

    
    $queried_object = get_queried_object();
    $post_id = $queried_object->ID;
    $forside_slagord_stor = get_field('forside_slagord_stor', $post_id);
    $forside_slagord_liten = get_field('forside_slagord_liten', $post_id);
    $forside_slagord_liter = get_field('om_oss_tekst', $post_id);
    

    To be honest, I’m not sure that will work because there isn’t enough information to tell.