Home › Forums › ACF PRO › Link to PDF broken › Reply To: Link to PDF broken
That’s weird. Could you please make sure that the file is set to the custom field?
Looking at the result, it seems the Return Value is set to “File ID” or there’s something on your site that prevents the conversion from the file ID to the URL.
Could you please help me debug the issue by trying to reproduce the issue on one of the WordPress’ stock themes (like Twenty Sixteen) with other plugins deactivated? If it disappears, then you can activate the theme and plugins one by one to see which one causes the issue.
If the issue persists, could you please try to debug it like this:
1. Set the Return Value to “File Array”.
2. Check the returned value like this:
<a href="" target="_blank" class='lnkPrintable mobile'><h2>Print Schedule</h2></a> <?php $file_array = get_field('document_link', 1134); echo '<pre>'; print_r($file_array); echo '</pre>'; ?>
If it returns the correct data, then you should be able to add the link like this:
<?php $file_array = get_field('document_link', 1134); ?> <a href="<?php echo $file_array['url']; ?>" target="_blank" class='lnkPrintable mobile'><h2>Print Schedule</h2></a>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🤔 Curious about the ACF user experience? So are we! Help guide the evolution of ACF by taking part in our first ever Annual Survey and guarantee you’re represented in the results. https://t.co/0cgr9ZFOJ5— Advanced Custom Fields (@wp_acf) May 8, 2023
© 2023 Advanced Custom Fields.