Home Forums General Issues Call posts based on relationship value Reply To: Call posts based on relationship value

  • Ok… so I’ve tried it a few different way and am still missing it.

    I checked my database and here is what my Hello World! post has in it for directory_news:

    So that’s showing me that profiles with the ID of 65 and 23 are linked to that post…

    So then I thought I followed the example that you provided with this

    $mine = get_posts(array(			 
        'post_type' => 'post', // "post" because I'm calling regular blog posts? 
        'meta_query' => array(
        'key' => 'directory_news', // slug of custom field
        'value' => '65', // hardcoded it just to test
        'compare' => 'LIKE'

    You’ll see that instead of using the ID I just hardcoded 65 in there just to see if I could only pull that one…

    However this still spits out ALL posts.. and not the ones that have David in the relationship field.