hi
i have two custom post type “doctors” and “location” that each “doctors” post related to a “location” post using advanced custom field (relationship )
i want to write my wp_query code using $wpdb class and pure sql
$args = array(
‘post_type’ => ‘doctors’,
‘meta_query’ => array(
array(
‘key’ => ‘location’, // name of custom field
‘value’ => ‘”‘ . get_the_ID() . ‘”‘,
‘compare’ => ‘LIKE’
)
)
);
$testimonials = new WP_Query( $args );
please help me
Is there a reason why you want to write it in the pure sql?
but if you wanna know how that WP_Query translate to the sql, you can print out the request.
$testimonials = new WP_Query( $args );
echo $testimonials->request; // <- this is the sql statement
Cheers