Is it possible to use the below meta query with a post object field inside a repeater?
$related_articles = get_posts(array(
'post_type' => 'post',
'meta_query' => array(
'key' => 'related_articles', // name of custom field
'value' => '"' . get_the_ID() . '"',
'compare' => 'LIKE'
if( $related_articles ):
foreach( $related_articles as $article ):
// Do something to display the articles. Each article is a WP_Post object.
echo $article->post_title; // The post title
echo $article->post_excerpt; // The excerpt
echo get_the_post_thumbnail( $article->ID ); // The thumbnail
Viewing 1 post (of 1 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Making gutenprogress with my new site. All done with the block editor. I don't like it, but I can make it work. (There's a lot in life like that.) HOWEVER, @wp_acf is letting me create custom blocks that do exactly what I need. That's a good thing.