I have the following code:
<?php if(the_field('required_libraries') ) { echo 'Title' . $required_libraries; } ?>
The field does exist and it displays correctly. However, the ‘Title’ text does not.
This works for me where there aren’t any variables, so I don’t quite understand why it isn’t working here.
I’m not sure I understand your question. You might need to use isset in your if statement.
Can you post what your “the_field” function does?
Update
Per the documentation you provided, it looks like you should use get_field() in the if statement (not the_field()).
It looks like the_field() echos the field value, so you could also do this: