Home Forums General Issues Take custom fields from single post


Take custom fields from single post

  • Hello. I want to take custom fields from single post. For example, I take the post like ‘$my_post = get_post(22);’ However I don’t take him in a loop and I have no able to use construction like get_field(‘my_field_name’); It doesn’t work for single post.

    How this situation can be solved?

  • If you want to get fields from a post with the ID of 22 then you need to do something like

    $value = get_field('my_field_name', 22);

    For more information see the section on Get Value from a Specific Post on this page

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

The topic ‘Take custom fields from single post’ is closed to new replies.