Custom post type paging return home page

I am having problem with Custom post type paging. Clicking on 2nd page of paging through back to home page. Permalinks flush/refreshed and i am using simple code to show custom post.

following is my code

$  cpt_type =  get_the_title(); $  paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; $  custom_terms = get_terms('types'); $  args = array('posts_per_page' => 4, 'post_type' => $  cpt_type, 'paged' => $  paged, 'order', 'desc'/*, 'tax_query' => array( array('taxonomy' => 'type', 'field' => 'slug', 'terms' => $  custom_term->slug ))*/); $  customPostQuery = new WP_Query($  args); if($  customPostQuery->have_posts() ):     while($  customPostQuery->have_posts()) : $  customPostQuery->the_post();         global $  post;  <h4>Terms: <?php $  custom_term->name; ?></h4> <h3 class ="cq-h3"><a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a></h3> <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('thumbnail'); ?></a> <p><?php echo the_content(); ?></p>  endwhile;     function cpt_pagination($  pages = '', $  range = 4){         $  showitems = ($  range * 2)+1;         global $  paged;         if(empty($  paged)) $  paged = 1;         if($  pages == ''){             global $  wp_query;             $  pages = $  wp_query->max_num_pages;             if(!$  pages){                 $  pages = 1;             }         }         if(1 != $  pages){             echo "<nav aria-label='Page navigation example'>  <ul class='pagination'> <span>Page ".$  paged." of ".$  pages."</span>";             if($  paged > 2 && $  paged > $  range+1 && $  showitems < $  pages) echo "<a href='".get_pagenum_link(1)."'>&laquo; First</a>";             if($  paged > 1 && $  showitems < $  pages) echo "<a href='".get_pagenum_link($  paged - 1)."'>&lsaquo; Previous</a>";             for ($  i=1; $  i <= $  pages; $  i++){                 if (1 != $  pages &&( !($  i >= $  paged+$  range+1 || $  i <= $  paged-$  range-1) || $  pages <= $  showitems )){                     echo ($  paged == $  i)? "<li class=\"page-item active\"><a class='page-link'>".$  i."</a></li>":"<li class='page-item'> <a href='".get_pagenum_link($  i)."' class=\"page-link\">".$  i."</a></li>";                 }             }             if ($  paged < $  pages && $  showitems < $  pages) echo " <li class='page-item'><a class='page-link' href=\"".get_pagenum_link($  paged + 1)."\">i class='flaticon flaticon-back'></i></a></li>";             if ($  paged < $  pages-1 &&  $  paged+$  range-1 < $  pages && $  showitems < $  pages) echo " <li class='page-item'><a class='page-link' href='".get_pagenum_link($  pages)."'><i class='flaticon flaticon-arrow'></i></a></li>";             echo "</ul></nav>\n";         }     }     if (function_exists("cpt_pagination")) {         cpt_pagination($  customPostQuery->max_num_pages);     } 

kindly correct me where i’ve placed wrong code. my cpt is ‘lectures’