Returns an array of values (name => value) for a specific post.


get_fields([$post_id], [$format_value]);
  • $post_id (mixed) (Optional) The post ID where the values are saved. Defaults to the current post.
  • $format_value (bool) (Optional) Whether to apply formatting to the value. Defaults to true.


Output all fields

This example shows how to display all fields (name and value) in a list.


$fields = get_fields();

if( $fields ): ?>
		<?php foreach( $fields as $name => $value ): ?>
			<li><b><?php echo $name; ?></b> <?php echo $value; ?></li>
		<?php endforeach; ?>
<?php endif; ?>


This example shows how the get_fields() function can be used to debug the available values for the post = 123.


echo '<pre>';
	print_r( get_fields(123) );
echo '</pre>';



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.