I have a relationship acf field that displays posts from a custom post type that are then displayed on the front end.
The post type is publications and I want to link to the publications uploaded file as opposed to the single page link, how would I do this?
Here is the code for the relationship field I have:
$posts = get_sub_field('download_existing');
$existing_link_url = '';
foreach ((array)$posts as $link_posts) {
$existing_link_url = get_permalink($link_posts->ID);
}
I know I am getting the posts permalink in the for each loop but I have tried wp_get_attachment_url and it doesn't seem to link through the file.
Is it possible to do what I am trying to do, I have looked on the ACF website and searched for this but I can't find anything.