Home › Forums › ACF PRO › Display metadata of post object? › Reply To: Display metadata of post object?
You can get the published date with something like:
$publishDate = get_the_time('F d, Y', $featured_post->ID);
Change the format there, as needed. You’re getting the error on categories because of how you’re trying to spit out the $categories variable.
$categories will be an array of categories so to display them, you’d want to loop through the array. I don’t know what you want from the category (a link to the category, just the name, etc.) but it’d be something like:
foreach( $categories as $category ) {
echo $category->name;
}
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.