Displays the value of the specified field. This function is the same as echo get_field($field_name);


<?php the_field($field_name, $post_id); ?>
  • $field_name: the name of the field to be retrieved. eg “page_content” (required)
  • $post_id: Specific post ID where your value was entered. Defaults to current post ID (not required). This can also be options / taxonomies / users / etc


Display a value from the current post

<h2><?php the_field('text_field'); ?></h2>

Display a value from a specific post

<h2><?php the_field('text_field', 123); ?></h2>

Check if value exists

<?php if( get_field('text_field') ): ?>
	<h2><?php the_field('text_field'); ?></h2>
<?php endif; ?>

Display a value from other places

$post_id = null; // current post
$post_id = 1; // post 1
$post_id = "option"; // options page
$post_id = "options"; // same as above
$post_id = "category_2"; // target a specific category
$post_id = "event_3"; // target a specific taxonomy (this tax is called "event")
$post_id = "user_1"; // target a specific user (user id = 1)

the_field( "text_field", $post_id );