Home › Forums › General Issues › URL field into button › Reply To: URL field into button
Hi celestial,
Thanks for your help !
I’ve tried your proposition and the text into the button is correctly displayed but the url return https://domain-name.com/vibes/Array
for every button I’ve created.
I’m using these buttons into a custom query :
<?php
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) :
?>
<?php
while ( $the_query->have_posts() ) : $the_query->the_post();
$url = parse_url( get_field( 'vibe_url', get_the_ID()) );
$btn_url = $url['host'] . $url['path'];
?>
<a class="wp-block-button__link" href="<?php echo $url; ?>"><?php echo $btn_url; ?></a>
<?php endwhile; ?>
<?php endif;?>
so I’ve guessed it could be a scoping issue but adding get_the_ID()
in second parameter doesn’t help 🙁
What do you think?
Thanks again,
J
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.