Title: ACF Related url
Last modified: March 23, 2021

---

# ACF Related url

 *  [finnfin](https://wordpress.org/support/users/finnfin/)
 * (@finnfin)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/acf-related-shortcode/)
 * Hi,
    I have a strange issue which is driving me crazy. I’m trying to link to 
   a related post. This works fine
 *     ```
       [related field_name]
         [field link]
       [/related]
       ```
   
 * But if I try to use
 *     ```
       [related field_name]
         <a href="[field url]">[field first_name]</a>
       [/related]
       ```
   
 * It only shows link to current page. `[field url]` alone without the href tag 
   works fine inside the related shortcode as well.
 * If that’s not gonna work, my other question is how can I set the [field link]
   text to be an ACF field for example `[field first_name]`, and not the title of
   a post?
 * Thanks!
    -  This topic was modified 5 years, 1 month ago by [finnfin](https://wordpress.org/support/users/finnfin/).

Viewing 10 replies - 1 through 10 (of 10 total)

 *  [polarracing](https://wordpress.org/support/users/polarracing/)
 * (@polarracing)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/acf-related-shortcode/#post-14225676)
 * The wordpress content filter hits in.
 * Try this:
 *     ```
       [related field_name]
       [pass field=url,first_name]
         <a href="{URL}">{FIRST_NAME}</a>
       [/pass]
       [/related]
       ```
   
    -  This reply was modified 5 years, 1 month ago by [polarracing](https://wordpress.org/support/users/polarracing/).
 *  Thread Starter [finnfin](https://wordpress.org/support/users/finnfin/)
 * (@finnfin)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/acf-related-shortcode/#post-14225737)
 * Thanks for the quick reply. That didn’t seem to quite work though. Neither URL
   or field value seems to have passed. I see {FIRST_NAME} as link text and link
   is pointing to ../%7BURL%7D
 *  [polarracing](https://wordpress.org/support/users/polarracing/)
 * (@polarracing)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/acf-related-shortcode/#post-14225763)
 * OK then the fields are not part of related
    This should work
 *     ```
       [pass field=url,first_name]
       [related field_name]
         <a href="{URL}">{FIRST_NAME}</a>
       [/related]
       [/pass]
       ```
   
 *  Thread Starter [finnfin](https://wordpress.org/support/users/finnfin/)
 * (@finnfin)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/acf-related-shortcode/#post-14225865)
 * They are a part of related, but I forgot to mention the related field is inside
   of a repeater, sorry about that. Could that somehow be causing the issue?
 * That second suggestion gives the same result as first.
 * Thanks for the help, I really appreciate it.
 *  [polarracing](https://wordpress.org/support/users/polarracing/)
 * (@polarracing)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/acf-related-shortcode/#post-14225949)
 * Post the result source code
 *  [polarracing](https://wordpress.org/support/users/polarracing/)
 * (@polarracing)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/acf-related-shortcode/#post-14225953)
 * Or try this:
 *     ```
       [related field_name]
       [link field=url][field first_name][/link]
       [/related]
       ```
   
 *  Thread Starter [finnfin](https://wordpress.org/support/users/finnfin/)
 * (@finnfin)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/acf-related-shortcode/#post-14226022)
 * That works! Thank you very much. Workaround for the href issue, but as long as
   it works! Was wondering there must be a way to use it like that, but didn’t know
   the [/url] syntax.
    Thanks again!
 *  Thread Starter [finnfin](https://wordpress.org/support/users/finnfin/)
 * (@finnfin)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/acf-related-shortcode/#post-14228481)
 * One more quick question. When using the [link] shortcode like this, is there 
   a way to set the target attribute to be new tab?
 *  [polarracing](https://wordpress.org/support/users/polarracing/)
 * (@polarracing)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/acf-related-shortcode/#post-14229373)
 * open=new
 *  Thread Starter [finnfin](https://wordpress.org/support/users/finnfin/)
 * (@finnfin)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/acf-related-shortcode/#post-14229552)
 * Perfect! Thank you!

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘ACF Related url’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-content-shortcode_766976.svg)
 * [Custom Content Shortcode](https://wordpress.org/plugins/custom-content-shortcode/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-content-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-content-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-content-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-content-shortcode/reviews/)

 * 10 replies
 * 2 participants
 * Last reply from: [finnfin](https://wordpress.org/support/users/finnfin/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/acf-related-shortcode/#post-14229552)
 * Status: not resolved