Home Forums General Issues Get Custom Field value from page?


Get Custom Field value from page?

  • Hi, I feel like this has an obvious answer, but I’ve yet to find it. I have a few custom fields bound to a page type, but I’m unsure how to retrieve the value of these fields in my template. All resources reference the_field() and/or get_post_meta(), but both of these are for posts, not pages. Any help?

  • Pages are just posts, so as long as you use get_field with a post id (assuming you are not in the loop) you should be fine.

    For instance:

    $field_value = get_field( 'my_awesome_field', $page_id );
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.