hubsta / acf-snippet-vsc

11 stars 9 forks source link

Suggestion #11

Open lazy-dog opened 4 years ago

lazy-dog commented 4 years ago

get_field makes a request to the database, you can do it in 1 query like this:

<?php if ( $field = get_field('field_name') ) : ?> <?php echo $field; ?> <?php endif; ?>