Take the 2-minute tour ×
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
5  
Your research efforts are …? –  toscho Jul 3 '12 at 16:20
    
@toscho - looking through the plugin documentation: advancedcustomfields.com/docs/getting-started –  Brian Jul 3 '12 at 16:25
2  
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
4  
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
add comment

1 Answer 1

up vote 9 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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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