ACF custom field in [closed]

In the header.php template, you cannot access the $post variable.

So you will have to map it using $wp_query, as mentioned on ACF forum here.

Try this:

<?php 
global $wp_query;  
$post = $wp_query->post;
$background = get_field('background', $post->ID); 
?>

<style>
    .site-header {
        background: url(<?php echo $background; ?>) no-repeat center;
        background-size: cover;
    }
</style>

error code: 523