Post to User Issue
-
I have users attached to a custom post type. When I try to loop through the users, it show every connected user not just the one for the post. I know the main query loop is only executed once so I am sure that is not the issue.
Here is the code I am using:
$args = array(
‘showposts’ => 1,
‘post_type’ => ‘rotary-committees’,
‘p’ => 4230
);
$query = new WP_Query( $args );
while ( $query->have_posts() ) : $query->the_post();
$memberTable .= ‘my posts ‘;$users = get_users( array(
‘connected_type’ => ‘committees_to_users’,
‘connected_items’ => $post
));
foreach($users as $user) {
$memberTable .= $user->display_name;
}endwhile;
wp_reset_postdata();
}Thanks for your help
- The topic ‘Post to User Issue’ is closed to new replies.