Hi & thanks for the great plugin Scribu!
I’m sure I’m just being dense but I can’t get a custom WP_Query to filter out posts that aren’t connected via P2P. I have two custom post types, Directory and Projects, and a reciprocal connection between them, directory_to_projects. I want to display a list of all Directory items that have one or more connections to Projects. This is my query:
$args = array( 'post_status' => 'publish', 'post_type' => 'directory', 'meta_key' => 'faculty_last', 'orderby' => 'meta_value', 'order' => 'asc', 'posts_per_page' => -1, 'nopaging' => true, 'suppress_filters' => false, 'connected_type' => 'directory_to_projects', 'connected_direction' => 'any', 'connected_items' => 'any', ); $dir_query = new WP_Query($args);
When I remove the last three args, the full list of Directory items appears – but with the args in there I get nothing. I should get just one record, as only one of my Directory items is currently connected to any Projects. Any ideas where I’m going wrong? I’ve read about a billion support posts but I just can’t figure it out. Thanks for your help!!!
- The topic ‘Show only custom post type which has a connection’ is closed to new replies.