How Can We Help?
< Back
You are here:
Print

ACF get_field()

Get a value from the current post

This example shows how to load the value of field ‘text_field’ from the current post.
$value = get_field( “text_field” );

Get a value from a specific post

This example shows how to load the value of field ‘text_field’ from the post with ID = 123.
$value = get_field( “text_field”, 123 );

Check if value exists

This example shows how to check if a value exists for a field.
$value = get_field( “text_field” );

if( $value ) {

echo $value;

} else {

echo 'empty';

}

Table of Contents