Home › Forums › ACF PRO › Get values in a widget with get_post_meta() › Reply To: Get values in a widget with get_post_meta()
Hi @vasili
This should be possible, but you will also need to get the page/post id and pass this as the first parameter. The code would look like so:
global $wp_query;
if(is_object($wp_query->queried_object) && $wp_query->queried_object->ID)
{
echo get_post_meta($wp_query->queried_object->ID, 'field_name', true);
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.