Title: How do I get the attachment url? &#8211; Function reference
Last modified: August 21, 2016

---

# How do I get the attachment url? – Function reference

 *  [jdank](https://wordpress.org/support/users/jdank/)
 * (@jdank)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/how-do-i-get-the-attachment-url-function-reference/)
 * I have a “gallery” that contains posts from a category. The gallery is on the“
   download section” page. It displays all the thumbnails posts from the category“
   documents”.
 * With the WCK plugin I added a field to attach uploaded *.pdf files to the post.
 * What I want: When I click on one post in the gallery, it must link to the uploaded
   pdf file.
 * In the code within the loop, I try to call the url of the uploaded attachment
   in the following way:
 * `<a href="<?php echo wp_get_attachment_link(); ?>"`
 * But now the only link I get is : “missing attachment”.
 * Where can I find the correct code to get the link of my uploaded attachment?
 * Thanks in advance!
 * _The url of the page:
    [http://www.solar-sell.eu/documenten-database/](http://www.solar-sell.eu/documenten-database/)
 * [http://wordpress.org/plugins/wck-custom-fields-and-custom-post-types-creator/](http://wordpress.org/plugins/wck-custom-fields-and-custom-post-types-creator/)

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

 *  Plugin Author [madalin.ungureanu](https://wordpress.org/support/users/madalinungureanu/)
 * (@madalinungureanu)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/how-do-i-get-the-attachment-url-function-reference/#post-4412715)
 * Hi,
 * Please check out this documentation page [http://www.cozmoslabs.com/docs/wordpress-creation-kit-documentation/upload/](http://www.cozmoslabs.com/docs/wordpress-creation-kit-documentation/upload/)
   that details how to use the upload field.
 *  Thread Starter [jdank](https://wordpress.org/support/users/jdank/)
 * (@jdank)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/how-do-i-get-the-attachment-url-function-reference/#post-4412814)
 * [@madalin](https://wordpress.org/support/users/madalin/): Thanks! It’s working
   now.
    I was searching for this: `<img src="<?php the_cfc_field('my_meta_name','
   avatar'); ?>" />`
 * I now have an upload field for a specific post.
    I configured it at the custom
   fields creator.
 * There is a field called “post id” under meta box arguments. I can fill in the
   ID of a post on which the meta box should appear.
 * How do I add this custom field to multiple posts? Or even better; add it to posts
   in a specific category?
 * I now have to fill in a specific ID of a post on which the meta box should appear.
   I want to know if it is possible to **add the custom field to all posts by default**,
   instead of one specific post?
 * Thanks in advance!

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

The topic ‘How do I get the attachment url? – Function reference’ is closed to new
replies.

 * ![](https://ps.w.org/wck-custom-fields-and-custom-post-types-creator/assets/icon-
   256x256.png?rev=2257602)
 * [Custom Post Types and Custom Fields creator - WCK](https://wordpress.org/plugins/wck-custom-fields-and-custom-post-types-creator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wck-custom-fields-and-custom-post-types-creator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wck-custom-fields-and-custom-post-types-creator/)
 * [Active Topics](https://wordpress.org/support/plugin/wck-custom-fields-and-custom-post-types-creator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wck-custom-fields-and-custom-post-types-creator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wck-custom-fields-and-custom-post-types-creator/reviews/)

## Tags

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

 * 2 replies
 * 2 participants
 * Last reply from: [jdank](https://wordpress.org/support/users/jdank/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/how-do-i-get-the-attachment-url-function-reference/#post-4412814)
 * Status: not resolved