Home Forums ACF PRO Link to PDF broken


Link to PDF broken

  • I replaced ACF with ACF Pro and the Print Meeting Schedule button is not linking to the PDF download. I also updated all other components.

    Here’s the code that’s always worked:
    <a href="<?=get_field('document_link', 1134)?>" target="_blank" class='lnkPrintable mobile'><h2>Print Schedule</h2></a>

  • Hi @jknetdesign

    It seems there’s something wrong with your code. Could you please try the following code?

    <a href="<?php echo get_field('document_link', 1134); ?>" target="_blank" class='lnkPrintable mobile'><h2>Print Schedule</h2></a>

    Also, please don’t forget to set the Return Value to “File URL”.

    I hope this helps ๐Ÿ™‚

  • If you check now it returns the URL

    Please clarify: set the Return Value to โ€œFile URLโ€

  • Actually, confirmed, its is set to
    Field Type > File
    Return Value > File URL

  • So…it’s not resolved. Please help.

  • 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>
    $file_array = get_field('document_link', 1134);
    echo '<pre>';
    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>


  • Here’s what I did:
    – updated permalinks
    – activated twentytwelve, when I did this the buttons are gone because they’re built into the child theme
    – deactivated plugins, when I deactivated Simple Custom Post Type something weird happened. I reloaded the page and got directed to the home page.

    Screenshot attached shows the File URL setting.

    The PDF we should get i

  • Hi @jknetdesign

    Twenty Twelve is a very old theme, could you please try it on Twenty Sixteen instead? After that, could you please add the code to the template file and see if it returns the correct data? If it returns the correct data, then it has something to do with your theme. In this case, I suggest you get in touch with your theme author instead.

    Also, could you please create staging/development site, open a new support ticket and provide temporary admin credentials to the staging site? You can open a new ticket here: Also, please don’t forget to explain the issue again and provide the link to this thread.

    That way, we could try to do some tests without affecting your live site.

    Thanks ๐Ÿ™‚

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Link to PDF broken’ is closed to new replies.