I have some code like:
<?php
if(get_field('review'))
$videoReview = get_field('review', false, false);
$String = explode("?v=", $videoReview)[1];
{ echo '<div class="youtube-player" data-id="' . $String . '"></div>'; } ?>
And no matter what the div appears on the page. I know that in many circumstances the review
field is empty in the db but it still comes through as if it was populated. The if statement works in most cases but here it seems to be ignored.
Any ideas?
Can you not create a variable for review and then just check if it’s set?
<?php
$review= get_field('review');
if (isset ($review)) {
echo '<div class="youtube-player" data-id="' . $String . '"></div>';
} ?>