why is is_post_type_archive returning false even on post_type archive page


I have created a custom as below in a plugin.

$args = array(
 'labels' => $labels,
 'show_ui' => true,
 'show_in_menu' => true,
 'show_in_rest' => true,
 'has_archive' => true,
 'capability_type' => 'post',
 'hierarchical' => false,
 'menu_position' => 26,
 'menu_icon' => 'dashicons-book-alt',
 'supports' => array('title', 'editor', 'author', 'excerpt', 'comments', 'post-formats','thumbnail'),
register_post_type('stories', $args);

And I am trying to create an archive page for it. following https://wordpress.stackexchange.com/a/116025/174579. But is_post_type_archive('stories') is always returning a true. What could be missing?

Note: I am using https://domainname.com/stories/

Isakiye Afasha 2 months 0 Answers 20 views 0

Leave an answer