Home › Forums › General Issues › Reverse relationship – the_content › Reply To: Reverse relationship – the_content
Hi renee, kylu –
the reason this won’t work is that the_content and get_the_content are only meant to be used within ‘The Loop’ and therefore do not accept a post id parameter.
my personal solution to this would be using WP_Query directly (rather than get_posts) to create a secondary loop, but within the context of your code above you can probably get around this through the use of setup_postdata as in the example here:
http://codex.wordpress.org/Template_Tags/get_posts#Access_all_post_data
and remember to call wp_reset_postdata after the fact.
EDIT: as an afterthought… you should be able to access all post data directly from your $items array the same way you are accessing the id. the only problem is that this bypasses all content filters so you would have to apply them manually.
something like:
$content = apply_filters( 'the_content', $item->post_content );
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.