Support

Account

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; ?>