Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How do I check and see if a value is set in an Advanced Custom Field?

share|improve this question

closed as off-topic by Pieter Goosen, Mayeenul Islam, cybmeta, Mark Kaplun, Robert hue Feb 3 at 7:41

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

Your research efforts are …? – toscho Jul 3 '12 at 16:20
@toscho - looking through the plugin documentation: – Matt Jul 3 '12 at 16:25
You didn't look through it all, then. Menu item 4 -> functions -> click "get_field" -> Usage -> if/else example. – SickHippie Jul 3 '12 at 16:34
Matt, Research Efforts = code references you found while looking the documentation + better description of the problem (Do you mean front or back-end?) :.....: Also, the Content of your Question is exactly the same as the Title: it really makes it look like WPSE is a magic box where you drop a one line issue and some solution will self-generate... – brasofilo Jul 3 '12 at 16:38

1 Answer 1

up vote 11 down vote accepted

You can see in the docs that you get the values by get_field(), so do something like this:

$values = get_field( 'field_name' );
if ( $values ) {
    echo 'A value is set';
} else {
    echo 'A value is not set';

Change field_name to your wanted field.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.