Support

Account

Home Forums Front-end Issues ACF Fields suddenly stopped showing

Solving

ACF Fields suddenly stopped showing

  • Hi I built a website a few years ago and left it alone to do it’s thing. I happened to take a look at it today for the first time in ages and realised that all the ACF fields that were showing now aren’t.

    I call the field data using this type of code

    if(get_field('name')){
    $field_name = "name";
    $field = get_field_object($field_name);
    echo '<strong>', $field['label'],'</strong>' . ': ' . $field['value'],'</br>';}
    
    if(get_field('address')){
    $field_name = "address";
    $field = get_field_object($field_name);
    echo '<strong>', $field['label'],'</strong>' . ': ' . $field['value'],'</br>';}

    But nothing is showing up. I ran all the single.php code through a php checker and no issues are found.

    Real head scratcher for me this if anyone has any ideas it would be really really appreciated.

    the website is – http://www.moochandpotter.co.uk
    If you take a look at a listing such as http://www.moochandpotter.co.uk/thedirectory/abbey-lakes-fishery-orrell/

    It should have name, address, fish in the lake, and a whole array of other data right at the bottom of the page but nothing is there.

    Puzzled it all worked a 12 months ago for sure.

  • I have had a look into this and it seems I am using an if statement that has since been changed since PHP V5.3.

    I other words in PHP V5.3 this code shows all the ACF field data

    if(get_field('name'))
    $field_name = "name";
    if(empty($field_name['name'])){
    
        echo " ";}
    
    else
    ....

    However if you upgrade from 5.3 upward this statement stops the PHP fields showing … take the ‘if’ statement out it all shows again.

    So it seems I need to upgrade this ‘if’ statement somehow

  • What version did you upgrade to. There were some recent bugs that caused fields to return incorrect values that have been fixed. Please make sure you’re using the most recent version of ACF and if you are still seeing problems submit a bug report here https://www.advancedcustomfields.com/contact/

  • Hi John, I upgraded to V7 from 5.3. I did it sometime ago but never realised the ACF data was missing it was just something I did.

    All the same winding back to V5.3 ensures everything is working fine.

    I am using the latest version of ACF too Version 4.4.12

    I have also double checked the fields show on PHP V5.3 but not 5.4, 5.5, 5.6 or 7

    I’ve taken your advice and submitted a bug report its all a bit odd.

  • Just for the record I have updated to V5.7.1 of ACF. Bought the developer license to see if that fixed it.

    No joy still only shows fields under PHP V5.3

    It’s something to do with this code for certain

    
    if(get_field('name'))
    $field_name = "name";
    if(empty($field_name['name'])){
    
        echo " ";}
    
    else
    ....
  • I am also having this issue, updated from god knows how long ago and suddenly they are not showing

  • I am also much less coding literate than the above

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

The topic ‘ACF Fields suddenly stopped showing’ is closed to new replies.