I want to link a Post Title to the PDF. I feel my solution is somewhere in wp_get_attachment_url() but I can't figure out how. Also, I'd like my pdf to be located in ../wp-content/uploads/year/month/pdf-name.pdf for about 12 post going back 2 years. Please point me in the right direction. Thanks.


1 Answer 1


I recommend using the plugin Advanced Custom Fields (Very popular plugin). It lets you create fields and manage their values very easily.

This way you could just create a new field for file upload and then to pull its information like this-

    $my_file = get_field('my_file');
    if( $my_file ) {
        echo $my_file['url'];
        echo $my_file['alt'];
        echo $my_file['...
  • I'm trying to stay away from using a plugin to do this. I feel like it should be a pretty simple operation. Just can't believe I'm the first dev to try and do this.
    – MWA
    Dec 8, 2016 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.