Support

Account

Home Forums General Issues Get value from page in header.php

Solved

Get value from page in header.php

  • Hi!
    Is it possible to get the value of a field that is located on a page, to my header.php file? I’m trying to get the preamble of the site to be my meta description. I do not want to use the bloginfo('description');-tag for my preamble either.

    Thanks!

  • Are you storing what you want on a post or page? If you are then you just need to supply the post ID where the value is stored when getting the field. https://www.advancedcustomfields.com/resources/how-to-get-values-from-another-post/

  • I store it on a page. I called for the field in the header.php but the meta-tag showed up empty. I called the field like so: <?php the_field('field', 300); ?> where 300 is the ID of the page where the value is stored.

  • If there’s a value stored there then it should be working? When you look at the source of the page do you find multiple meta tags? Do you have any seo plugins installed that may be somehow altering the header?

  • I got it working now, seems like I called for the wrong ID. That was awkward 😛 Thanks anyway!

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

The topic ‘Get value from page in header.php’ is closed to new replies.