Display ACF object field data using Elementor Custom Query

[ad_1]

Hello i’m working on a website using elementor pro + ACF. I have create a custom post type (CPT1) with ACF object field that take another CPT2 as values. I would like to display on my CPT1 page all CPT2 linked. **How can I used Custom Query to display this?** I tried to write this but still not working

“`
add_action(‘elementor/query/13600’, function ($query) {
$query->set(‘post_type’, [‘CPT2’]);
$meta_query[] = [
‘post__in’ => get_field([‘cpt1_field_for_cpt2’]),
];
$query->set(‘meta_query’, $meta_query);
});
“`

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer