Advanced Custom Fields
[resolved] How do I Href with ACF? (4 posts)

  1. Dvd709
    Posted 2 years ago #

    Hi guys,

    I have 1 field which is a text field.

    Field: Url - Text
    Say the value of Url = http://www.google.com

    So when I Href in a while like so:

    <a href="<?php the_field('url'); ?>"></a></br></p>

    When you click on a link you get a 404 and this happens: http://www.mywordpresssite.com/Url(www.google.com)

    So basically I want the href value as shown value on my site, but automatically because there's about 300 other pages on which this has to happen. So every page has different urls.

    I can't seem to figure it out.

    Thanks in advance!


  2. Dvd709
    Posted 2 years ago #


  3. familyarmstead
    Posted 2 years ago #

    I ran across your post when hunting for an answer to the same question. Signed up here just so I could share this because I found the way through trial and error and, probably folks with experience will chuckle that we didn't figure it out faster. Oh well, one day we will be folks with experience also. ;) Here's what I did:

    <a href="<?php the_field ('url-field-name'); ?>"> MUST HAVE TEXT HERE</a>

    Put that 'must have' in caps because it is the essential part. Just like when we add a link via the wysiwyg editor, we have to have something/word for the link to 'attach' to so that there is something to click on.

    I hope this helps if you have not already figured it out, or at least helps the next person. :)

  4. Dvd709
    Posted 2 years ago #

    Thanks! I appreciate the help but I figured it out just the way you did as well hehe. Yes we once will help others here :D. It as well would be great for other people trying to figure it out!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Advanced Custom Fields
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic