Title: Problem with post type archive url
Last modified: February 5, 2021

---

# Problem with post type archive url

 *  [theshae](https://wordpress.org/support/users/theshae/)
 * (@theshae)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/problem-with-post-type-archive-url/)
 * Im trying to link to my post archive url but It’s adding the ” ” weird and I 
   cant actually create a link.
 * I can loop through and show the titles and the urls with:
 *     ```
       <ul>
       [for type=all]
         <li><a href="[each url]">[each name]</a></li>
       [/for]
       </ul>
       ```
   
 * But this isn’t working

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

 *  [polarracing](https://wordpress.org/support/users/polarracing/)
 * (@polarracing)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/problem-with-post-type-archive-url/#post-14011530)
 * Try:
 *     ```
       [for type=all]
       [pass field=url]
         <li><a href="{FIELD}">[each name]</a></li>
       [/pass]
       [/for]
       ```
   
    -  This reply was modified 5 years, 3 months ago by [polarracing](https://wordpress.org/support/users/polarracing/).
 *  Thread Starter [theshae](https://wordpress.org/support/users/theshae/)
 * (@theshae)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/problem-with-post-type-archive-url/#post-14046503)
 * That didn’t work. It’s listing all of the post types with a link, but ALL of 
   the URL’s are to the home page and not the archive page.
 *  Thread Starter [theshae](https://wordpress.org/support/users/theshae/)
 * (@theshae)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/problem-with-post-type-archive-url/#post-14048440)
 *     ```
       <ul>
       [for type=all]
         <li><a href="[each url]">[each name]</a></li>
       [/for]
       </ul>
       ```
   
 * This is the result I get
    [https://www.evernote.com/l/ALGwTuizR6lEs7U6dgJ4AOFfGO8S00IqeRM](https://www.evernote.com/l/ALGwTuizR6lEs7U6dgJ4AOFfGO8S00IqeRM)
 * The following prints the URL inside of quotes.
 *     ```
       <ul>
       [for type=all]
         <li>[each url]</li>
       [/for]
       </ul>
       ```
   
 * See here:
    [https://www.evernote.com/l/ALH4yo1jMf1DILlEwQgRvxCoS8ccGkVdsL4](https://www.evernote.com/l/ALH4yo1jMf1DILlEwQgRvxCoS8ccGkVdsL4)
 * If I try the code like this without the quotes on the href like this:
 *     ```
       <ul>
       [for type=all]
         <li><a href=[each url]>[each name]</a></li>
       [/for]
       </ul>
       ```
   
 * I get this:
    [https://www.evernote.com/l/ALFkwNUG2m1D9aK_LYGHio2C_kkql1BayZQ](https://www.evernote.com/l/ALFkwNUG2m1D9aK_LYGHio2C_kkql1BayZQ)
 * Any ideas why this happens?
    -  This reply was modified 5 years, 2 months ago by [theshae](https://wordpress.org/support/users/theshae/).
    -  This reply was modified 5 years, 2 months ago by [theshae](https://wordpress.org/support/users/theshae/).
    -  This reply was modified 5 years, 2 months ago by [theshae](https://wordpress.org/support/users/theshae/).
 *  [Peter Berger](https://wordpress.org/support/users/peterpolow/)
 * (@peterpolow)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/problem-with-post-type-archive-url/#post-14048558)
 * Would you try it with single quotes?
 *  Thread Starter [theshae](https://wordpress.org/support/users/theshae/)
 * (@theshae)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/problem-with-post-type-archive-url/#post-14057001)
 * I’ve tried that too. Still not working. Is anyone else getting the same results?
 *  [supremebeing](https://wordpress.org/support/users/supremebeing/)
 * (@supremebeing)
 * [5 years ago](https://wordpress.org/support/topic/problem-with-post-type-archive-url/#post-14354054)
 * *I hope this would help others as references:
 *     ```
       <ul>
       [for type=all]
         <li><a href=[each url]>[each name]</a></li>
       [/for]
       </ul>
       ```
   
 * is wrong if you are posting them through WordPress text editor.
 * Always pass vars into a functioning attributes of any HTML element.
 * Correct example that works for me:
 *     ```
       <ul>
       [for type=all]
         [set varurl][each url][/set]
         [pass vars]
         <li><a href="{VARURL}">[each name]</a></li>
         [/pass]
       [/for]
       </ul>
       ```
   
 * note: unless you set the ” in the var, otherwise url attribute needs to open&
   close with ” as it is.
 * I also avoid using -/_ when naming set vars eventhough it may not be relevant
   to the errors I got but not using them fixed my problems so I just consider this
   as a good practise to go.

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

The topic ‘Problem with post type archive 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/)

## Tags

 * [custom post type](https://wordpress.org/support/topic-tag/custom-post-type/)
 * [url](https://wordpress.org/support/topic-tag/url/)

 * 6 replies
 * 4 participants
 * Last reply from: [supremebeing](https://wordpress.org/support/users/supremebeing/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/problem-with-post-type-archive-url/#post-14354054)
 * Status: not resolved