6, // Number of related posts to display
'category__in' => $category_ids, // Fetch posts that belong to any of the current post's categories
'post__not_in' => array(get_the_ID()), // Exclude the current post from the related posts list
));
// Check if there are related posts
if ($related_posts_query->have_posts()) :
?>