Support

Account

Home Forums Backend Issues (wp-admin) get_field() not executing in header

Helping

get_field() not executing in header

  • I am trying to copy data from a custom field named ‘schema’ into my header. I have used the following code and I can see it in my header but it is not executing and I can’t see why. Can anyone please tell me what I’m doing wrong?

    <?php
    $schema = get_field(‘schema’);
    if ($schema) {
    echo $schema;
    } else {
    echo ’empty’;
    }
    ?>

  • Fixed. Rookie mistake, I was putting the code straight in the header and not in functions.php.

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

You must be logged in to reply to this topic.