I have used ACF hundreds of times but never to edit the meta description.
I have created a simple text field in ACF, then tried to use this script:
<?php $meta_description = get_field('meta_description'); ?> <?php if ($meta_description != '') : ?> <meta name="description" content="<?php echo $meta_description; ?>"/> <?php else : ?> <meta name="description" content="This could be an interesting meta description"/> <?php endif; ?>
But, it doesn't acknowledge the field, it simply does the 'else' from the if statement.
Here is a screenshot of my ACF set-up:
Do I need to sanitise the field or call it earlier or something? Not sure why this would work so well for all other fields but this one.
Here is the field being filled in on the pages:
Is this even possible?
Any help would be great!