Home › Forums › Front-end Issues › Remove 'http://' from text fields › Reply To: Remove 'http://' from text fields
Here is my code. It return the correct name but not the url itself
It looks like this on my site
“facebook.com/abcphotography”
href = my.site.com/facebook.com/abcphotography
Does anyone know why the root url is there?
Thanks
<?php if ( $site = get_field( 'vendor_fb' ) ) : ?>
<?php
$site = str_replace(array('http://', 'https://'), '', $site);
$site = rtrim($site, '/');?>
<a class="vendor-link" href="<?php echo $site ?>" target="_blank"><?php echo $site ?></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.