<?php
/**
 * Template Name: First Manga Chapter Page
 *
 * This is a page template you can use for the first manga chapter page
 *
 * @package Toocheke
 */
// Get layout and determine if it's traditional

$args = [
    'posts_per_page' => '1',
    'post_type'      => 'manga_chapter',
    'order'          => 'ASC',

];

$manga_chapter_posts = get_posts($args);
if ($manga_chapter_posts) {
    $url = get_permalink($manga_chapter_posts[0]->ID);

    wp_redirect($url, 301);
    exit;
}
