title: How to get Next/Previous Post titles under WP_Query loop?
body: <p>I have created a custom post type named "videos" for Wordpress project. Under that I have created a taxonomy named 'video-categories'. The purpose was to create a page where the Video will be shown on single-videos.php page and then there needed a loop below the Video showing list of all Videos. Now here is where I needed help. I built the Loop fine using this code</p>
  
  <pre><code>&lt;?php
  $args = array( 
      'post_type' =&gt; 'videos', 
      'posts_per_page' =&gt; -1,
      'tax_query' =&gt; array(
          array(
              'taxonomy' =&gt; 'video-categories',
              'field' =&gt; 'id',
              'terms' =&gt; $category_id
          )
      )
  );
  ?&gt;
  &lt;?php   $loop = new WP_Query( $args ); ?&gt;
  &lt;?php   if($loop) :?&gt;
  &lt;?php   while ( $loop-&gt;have_posts() ) : $loop-&gt;the_post();?&gt;
  
  ... things to do inside the loop ...
  
  &lt;?php   endwhile; ?&gt;
  &lt;?php   endif;?&gt;
  &lt;?php   wp_reset_postdata();?&gt;
  </code></pre>
  
  <p>The <code>$category_id</code> variable holds <code>video-category</code> ID of the current post. This loop lists all Videos fine but what I need to do is, I want to put a link for Next and Previous posts under <strong>Same term</strong> which is here <strong>$category_id</strong></p>
  
  <p>So generally, I am trying to find a way to get the next and previous posts under <code>WP_Query</code>.</p>