I have having trouble querying posts using parameters passed in the URL.
I have two custom post types I am connecting reciprocally, Athletes and Sports. For testing, I print out 1) the actual Sport ID, 2) the title and IDs of the athletes that are connected to that sport. This is done using the code:
$athletes_query = new WP_Query(array('post_type' => 'athletes', 'connected_to' => get_queried_object_id()));
echo get_queried_object_id();
echo $post->ID;
echo "<br/>";
foreach ($athletes_query->posts as $athlete) {
echo $athlete->post_name."-";
echo $athlete->ID.", ";
}
However, when I try to perform the same query via URL (for this example, the sport I'm looking at has a post ID of 87),
http://mysite.com/?post_type=athletes&connected_to=87
I am given all the athletes, not just the ones I connected to the sport.
What am I doing wrong here?