WordPress カレント表示

<?php
  $current_page_id = $wp_query->get_queried_object_id();
  $args = array(
      'posts_per_page' => -1,
      'post_type' => 'カスタム投稿'
  );
  $my_posts = get_posts($args);
?>
<?php foreach ($my_posts as $post): setup_postdata($post); ?>
  <li class="<?php if ($current_page_id == $post->ID ) {echo 'is_active';} ?>">
      <a href="<?php the_permalink(); ?>">
          <?php the_title(); ?>
      </a>
  </li>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>