I'm using ACF to add fields to a custom post type.

I've created an instance of WP_Query to set up a loop. Within the loop I can publish the standard fields using the_title() and the_content(). However, the ACF function the_field isn't publishing values for attached fields.

Neither 'the_field()' nor 'echo the_field()' products the field values.

So... how exactly can I publish these values?

This is my loop:

$jobs_query = new WP_Query($args) ;

if ($jobs_query->have_posts()) : ?>
    <section id="jobs-list">
        <?php while ($jobs_query->have_posts()) : $jobs_query->the_post(); ?>
            <article class="">
                <h3 class="job-title"><?php the_title()  ?></h3>

        <div class="employer">
            <p><?php  the_field('employer')  ?></p>         

        <div class="job-description">
            <?php echo  the_field('job_description')  ?>
                <p class="job-readmore"><a href="<?php echo get_permalink()  ?>">read more</a></p>
        <?php endwhile; ?>

<?php endif; ?>

1 Answer 1



$PostID = get_the_ID();
the_field('text_field', $PostID);
  • Please edit your answer, and add an explanation: why could that solve the problem?
    – fuxia
    Oct 25, 2020 at 2:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.