Get values from an options page


All the template functions (get_field, the_field, etc) can be used to load values from an options page, however, a second parameter is required to target the options page. This is similar to passing through a $post_id parameter to target a specific post object.

The $post_id parameter needed is a string containing the word ‘option’ or ‘options’.

Please note that although it is possible to create multiple options pages, all values are saved and loaded using ‘option’ as the $post_id.


Display a field

<p><?php the_field('field_name', 'option'); ?></p>

Retrieve a field


$variable = get_field('field_name', 'option');

// do something with $variable


Display a sub field

Note that when inside of a have_rows loop, you do not need to use the $post_id parameter for any sub field functions (get_sub_field, the_sub_field)

<?php if( have_rows('repeater', 'option') ): ?>


    <?php while( have_rows('repeater', 'option') ): the_row(); ?>

        <li><?php the_sub_field('title'); ?></li>

    <?php endwhile; ?>


<?php endif; ?>


We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.