Home › Forums › ACF PRO › Retrieve data from post-object them the post has been created with ACF comp. › Reply To: Retrieve data from post-object them the post has been created with ACF comp.
You just need to supply the post ID for WP and ACF. Going by your code
// use a wp function
$excerpt = get_the_excerpt($news->ID);
// use an acf field
$value = get_field('field_name', $news->ID);
I am assuming from your code that you are using a post object field. You can also use setup_postdata() as explained in the documentation.
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.