Home Forums General Issues Meta query for post object? Reply To: Meta query for post object?

  • Hello all,

    I’m doing a similar thing as above but finding it hard when my post_object has multiple objects.

    OK here is what I am doing:
    1. Custom post type with Courses in
    2. Custom post type with Tutors in
    3. On the Courses page there is a post object box where you select which tutors are deliverying the course.
    4. On the front end, on the single tutors page, it will list the courses this tutor is delivering.

    At the moment on the tutors page I have this:

    $args = array(
    'post_type'		=> 'cpt_courses',
    'posts_per_page'	=> -1,
    'meta_query'		=> array(
    		'key' => 'course_tutors',
    		'value' => '86',
    		'compare' => 'IN'
    // query
    $wp_query = new WP_Query( $args );
    // loop
    while( $wp_query->have_posts() )
    // ...

    Help help would be much appreciated, thanks