Support

Account

Home Forums General Issues get_field returning null after update Reply To: get_field returning null after update

  • RIP Advanced Custom Fields!

    So I have 100+ websites that I apparently now have to check, without any proper warnings. Very professional.. NOT.

    Downgrading to 5.11 did not work and now I have to look into 100+ production sites.

    For example, the code below does not work anymore. It shows empty values. Fields are registered via the WP admin (just the native ACF way). No registration via PHP involved.

    What’s wrong?

    <style>
    <?php if(get_field('header-achtergrond') == "image"):
    	$img_desktop = wp_get_attachment_image_src(get_field('header-image'), 'img-1920-1080');
    	$img_mobile = wp_get_attachment_image_src(get_field('header-image-mobile'), 'img-750-1334');
    	?>
    @media only screen and (min-width: 720px) {
    	.header-bg-img { background-image: url(<?php echo $img_desktop[0]; ?>); }
    	}
    @media only screen and (max-width: 719px) {
    	.header-bg-img { background-image: url(<?php echo $img_mobile[0]; ?>); }
    	}
    <?php endif; ?>
    </style>