Home › Forums › Front-end Issues › Page Link fails when cloned (Clone Field) › Reply To: Page Link fails when cloned (Clone Field)
This is definitely happening (and still happening – ACF V5.5.3, WP V4.7).
dkeeling – a workaround is to check if the value is numeric, and then run it through get_permalink() if it is.
Your code would look like this:
<?php
$button = get_field('header_button');
if($button): ?>
<a href="<?php echo ( is_numeric($button['link']) ? get_permalink($button['link']) : $button['link'] ); ?>"><?php echo $button['label']; ?></a>
<?php endif; ?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.