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>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.