Home › Forums › Front-end Issues › Wp_query with relationship to another custom post type › Reply To: Wp_query with relationship to another custom post type
Hello @keithlock, thanks for your help. But I dont have problem with “True/False” field, I need link the_query to another post_type with relationship field. Logic of query should be like this, but meta_query doesnt support “post_type”:
<?php
$args = array(
'post_type' => 'branch_clinic',
'posts_per_page' => 10,
'meta_query' => array(
array(
'post_type' => 'hospital',
'key' => 'template-part-clinic-heading__highlight',
'value' => '1',
),
),
);
$the_query = new WP_Query( $args );
?>
“template-part-clinic-heading__highlight” is TRUE/FALSE field in HOSPITAL post type, and this hospital is linked by relationship field to BRANCH CLINIC.
Thanks,
Jakub
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!
Accordions are a great way to group related information while allowing users to interactively show and hide content. In this video, Damon Cook goes in-depth on how to create an accessible accordion block using ACF PRO’s Repeater field.https://t.co/RXT0g25akN
— Advanced Custom Fields (@wp_acf) March 2, 2023
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.