Support

Account

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