Support

Account

Home Forums ACF PRO Link to PDF broken Reply To: Link to PDF broken

  • Hi @jknetdesign

    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>

    Thanks!