php – Worpdress Related Post Break WordPress Post Page


I am trying to get related post in my wordpress customised theme but the code i used worked really well on local server but does not work when i transfer it to digitalocean (vps).

<div class="desktop">
        <div class="box-list small desktop">    
            
            
       
            <?php $orig_post = $post;
global $post;
$categories = get_the_category($post->ID);
if ($categories) {
$category_ids = array();
foreach($categories as $individual_category) $category_ids() = $individual_category->term_id;

$args=array(
'category__in' => $category_ids,
'post__not_in' => array($post->ID),
'posts_per_page'=> 4, // Number of related posts that will be shown.
'ignore_sticky_posts'=>1
);

$my_query = new wp_query( $args );
if( $my_query->have_posts() ) {
echo '
<div class="section-header item-header desktop">
<div class="title">
<h2>More
    <span>Related Posts</span>
    on MonstaJams
    <span></span>
</h2>
</div>
</div>';
while( $my_query->have_posts() ) {
$my_query->the_post();?>

<div class="story">
                <a href="<?php the_permalink() ?>"><img src="https://wordpress.stackexchange.com/<?php the_post_thumbnail_url("thumbnail'); ?>">
                </a>
                <p class="title"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></p>
            </div>
<?
}
echo '';
}
}
$post = $orig_post;
wp_reset_query(); ?>
            
        </div>
    </div>

how can i resolve this to work really well and display the related posts without breaking my site?