Show ACF Custom Field Outside Loop

This is how to display an Advanced Custom Field (ACF) outside of the WordPress Loop:-

<?php the_field('field_name',$post->ID);?>

Or to extend the code to only show if the field is present:-

<?php if(get_field('field_name',$post->ID))
	echo '<p>' . get_field('field_name') . '</p>';

In our tests we have found that ‘the_field’ and ‘get_field’ are interchangeable methods – the main thing is to ensure that you add ‘$post->ID’.

About the Author
show acf custom field outside loop Show ACF Custom Field Outside Loop 0da77002febbfe28d15144a57bbcc2c9 s 180 d mm r g


A highly experienced Web Designer / Web Developer (Webflow, WordPress, Weebly & Custom), Front-end / Back-end Developer & New Media Specialist, with extensive knowledge of a wide spectrum of technologies in the Development and Creative Industries, built up over a number of years.