Home Forums Front-end Issues Blank fields


Blank fields

  • Hello,

    WP version: 3.6.1
    Settings screen grab attached.

    I set up a custom post type called “CV”. I then created some fields and assigned them to the custom post type. These all work perfectly:

    Today I opened the CV page template to add a “Download CV” button. So that my client can upload their own CV file, I created a new field group titled “Upload your CV”, selected the field type “File” and assigned it to the CV page template.

    After I’d taken these steps, I went to the CV page in WP Admin to upload the PDF. I then added this code on the CV Page template:

    <a href="<?php the_field('download_cv'); ?>">Download CV</a>

    On the front end, it seems the value is empty. I tried a plain text field type, but it also produced blank results.

    Hope you can help!



  • Hi @Squideyes
    Can you please debug the code like so:

    echo '<pre>';
    	var_dump( get_field('download_cv') );
    echo '</pre>';

    What do you get?

  • Hey Elliot. Thank you for your reply. I’ve received the following output after implementing your code:


    Looking forward to your feedback.


  • Hi @Squideyes

    Your debugging shows that ACF is unable to load the value. This can be due to 1 or 2 things:

    1. ACF has no idea which post to load the custom field from
    2. There is no value saved for the current post

    Can you explain in which file you are running this code. Is it within the loop? Can you test that the global $post is correct at the time when you run the ACF code?


  • This reply has been marked as private.
  • Hi @Squideyes

    Your code the_field('download_cv'); is outside of the loop! This is why ACF does not understand where to load the data from.

    Where is the data for ‘download_cv’ saved? Is it on the page which you have selected the CV template for?

    I think the issue is with all your global $wp_query stuff.

    You should use not override this global variable, but use a new variable. Also, make sure you use the reset_postdata function after the loop. This is all documented on the WP site.


  • You’re awesome!

    I need to use a special loop to get pagination working with custom post types.

    I used this method: and it worked perfectly.

    Thank you for pointing me in the right direction.

    WordPress developers would quit without your plugin.

    Keep up the good work!


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

The topic ‘Blank fields’ is closed to new replies.