I have created a post type named ‘faq’, and a page ‘faq’ for displaying the posts under faq. Also I have created a page template name faq and selected the faq page’s template to this.

Now the problem is the faq page always render default template, which is archive.php or index.php. I tried to change the template name to page-faq.php and page-{page_id}.php but failed to achieve desired result.

Is there any way to override default template in this case if I would not willing to change the page slug or post type.

1 Answer
1

Easy way to achieve this.

register_post_type( 'mypost',
    array(
        ...
        'has_archive' => false,
        ...
    )
);

After updating this reset the permalinks ‘Settings -> Permalink’

Leave a Reply

Your email address will not be published. Required fields are marked *