Wordpress循环拉动相关类别的帖子

I'm trying to create a loop that goes at the end of certain posts that will pull posts from related categories and exclude the current post. I feel like I'm close but it's still not quite working. It's just pulling all posts currently for some reason. Any help would be much appreciated.

$args = array(
    'posts_per_page' => 8,
    //'paged' => get_query_var('paged'), 
        'post__not_in' => array($post->ID),
    'category__in' => $cat_ID   
);

// The Query
query_posts( $args );

// The Loop
while ( have_posts() ) : the_post(); ?>

<div style="max-width: 1350px; margin: auto;">
<div id="post-container02">
  <div class="post-image"><a href="<?php the_permalink();?>"> <?php the_post_thumbnail(); ?></a></div>
  <div class="post-feed-title"><a href="<?php the_permalink();?>"> <?php the_title(); ?></a></div>
  <div class="read-more-button"><a href="<?php the_permalink(); ?>">Read More</a></div>
</div><!-- post-container01 -->

You may want to try this method within your main post loop. It will find the related categories and avoid the current category.

$related = get_posts( array( 'category__in' => wp_get_post_categories($post->ID), 'numberposts' => 5, 'post__not_in' => array($post->ID) ) );
if( $related ) foreach( $related as $post ) {
setup_postdata($post);
/*whatever you want to output*/
}
wp_reset_postdata();

https://wordpress.stackexchange.com/questions/30039/how-to-display-related-posts-from-same-category