Title: Error when inside wp_query
Last modified: August 20, 2016

---

# Error when inside wp_query

 *  [Dustin Jones](https://wordpress.org/support/users/domesticjones/)
 * (@domesticjones)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/error-when-inside-wp_query/)
 * So I know that I’m missing something simple here.
 * I have successfully connected the post type “webinar” to “speakers” and called
   the connection “webinar_speakers.” This works fine. But on the webinars page,
   I am using wp_query to pull in the webinars and I need to show the speaker within
   the pulled content. When I put the code within wp_query, it returns this error:
 * > Warning: Could not find direction(s). in /home/meetingj/public_html/wp-content/
   > plugins/posts-to-posts/core/query-post.php on line 16
 * Here’s the code I have in there now:
 * > `<?php $my_query = new WP_Query(‘post_status=future&post_type=webinar’); ?>
   > 
   > <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
   >  <a href=”<?php the_field(‘link_to_live_webinar’); ?>”><?php the_title(); ?
   > ></a>
   >  <?php
   >  // Find connected pages $connected = new WP_Query( array( ‘connected_type’
   > => ‘webinar_speakers’, ‘connected_items’ => get_queried_object(), ‘nopaging’
   > => true, ) );
   >  // Display connected pages
   >  if ( $connected->have_posts() ) : ?> <?php while(
   > $connected->have_posts() ) : $connected->the_post(); ?> <a href=”<?php the_permalink();?
   > >”><?php the_title(); ?></a> <?php the_post_thumbnail(‘thumbnail’, array(‘class’
   > => ‘alignright speakerthumb’)); ?> <?php endwhile; ?>
   >  <?php
   >  // Prevent weirdness wp_reset_postdata();
   >  endif;
   >  ?>
   > <?php wp_reset_query(); endwhile; ?>`
 * Plugin is functioning perfectly fine in every other facet of the site, just erring
   inside wp_query. Thank you for any help with this.
 * [http://wordpress.org/extend/plugins/posts-to-posts/](http://wordpress.org/extend/plugins/posts-to-posts/)

The topic ‘Error when inside wp_query’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/posts-to-posts_7a8e9d.svg)
 * [Posts 2 Posts](https://wordpress.org/plugins/posts-to-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/posts-to-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/posts-to-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/posts-to-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/posts-to-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/posts-to-posts/reviews/)

## Tags

 * [inside](https://wordpress.org/support/topic-tag/inside/)
 * [posts-2-posts](https://wordpress.org/support/topic-tag/posts-2-posts/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * 0 replies
 * 1 participant
 * Last reply from: [Dustin Jones](https://wordpress.org/support/users/domesticjones/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/error-when-inside-wp_query/)
 * Status: not resolved