1$value = get_field( "text_field" );
2
3if( $value ) {
4 echo $value;
5} else {
6 echo 'empty';
7}
1get_field($selector, [$post_id], [$format_value]);
2/*
3$selector (string) (Required) The field name or field key.
4$post_id (mixed) (Optional) The post ID where the value is saved. Defaults to the current post.
5$format_value (bool) (Optional) Whether to apply formatting logic. Defaults to true.
6*/
7// Get a value from the current post
8$value = get_field( "text_field" );
9// Get a value from a specific post
10$value = get_field( "field_name", $post_id );