I have a simple custom query driven by
<ul> <?php $args = array('post_type' => 'event', 'numberposts' => 6 ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); echo '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>'; endforeach; wp_reset_postdata(); ?> </ul>
However, there's a need to access this custom loop's query object - the one which is accessible by default if you do custom loops using
new WP_Query method. (This is needed to get connected posts of other CPTs, mechanism driven by the excellent Posts2Posts plugin's
each_connected.) Is it possible to get to the query object from
get_posts? Or the only way to do this is to remake the loop in the
new WP_Query style?